Moves Rubaship::Sector to its own file

Moves Rubaship::Sector from lib/rubaship/grid.rb do its own file on
lib/rubaship/sector.rb.
Also moves Sector specs from spec/grid_spec.rb to its own file on
spec/sector_spec.rb

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Creates a new Rubaship::Row class to improve code

Rubaship::Row class implemented with helper methods to handle multiple
formats (Fixnum, Strin, Symbol, index value) of row representation and
with the purpose of simplifying the code inside Rubaship::Grid class.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds Row.rows to generate string row arrays

Implements Row.rows to generate arrays of string rows.
Changes specs to use the Row#== method instead of comparing on top of
to_idx.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Creates a new Rubaship::Col class similar to Row

Rubaship::Col class implemented with helper methods to handle multiple
formats (Fixnum, String, Symbol, index value) of column representation
and with the purpose of simplifying the code inside Rubaship::Grid
class.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Rubaship::Col and Row improved #== implementation

Adds more spec tests to both Rubaship::Col and Row classe's #== method.
Improves Col#== method to support comparison with other Col objects.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds Range support to Row and Col implementations

Adds the following methods to Rubaship::Row and to Rubaship::Col:
  * #range?
  * #size
The previously implemented methods of Rubaship::Row: and Rubaship::Col:
  * #to_s
  * .to_idx
  * #to_sym for Row and #to_i for Col
were changed to handle Ranges properly.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Renames instance variable from @value to @idx

Renames Rubaship::Col and Rubaship::Row's instance variable from @value
to @idx so that it makes more sense as to what it holds and to shorten
up code a little bit.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Removes support for zero based column creation

Col.new no longer accepts a boolean zero based argument
Only column numbers from 1 to 10 either Fixnum or String are supported
from now on.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Fixes issue in String to Fixnum conversion of 10

Conversion of the string "10" wasn't covered with the previous code,
used ruby Integer(string) method to properly convert "10" into 10.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Removes Col.cols and Row.rows

Access to the valid cols and rows arrays are still available through
the use of Col::COLS and Row::ROWS
Also changes these constants values to the ones that match a grid of
size 10x10, i.e. COLS = 1..10 and ROWS = A..J.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Improves Row and Col to raise exceptions

Row.is_valid? and Col.is_valid? are new methods for argument validation
checking and delegate conversion functionality to their respective
already existent Row.to_idx and Col.to_idx methods which no longer are
responsible for it.
Changes Row and Col #initialize methods to use the above two methods to
convert and validate the argument used to create a new instance and
raise an error if not valid.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds support for altering a Row/Col into a range

Implements Row#rangify! and Col#rangify! to transform respectively
a row or a col into a range given a specified size.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Fixes issue with lower case strings and symbols

Fixes an issue with the creation of a new row with a lower case String
or Symbol where it was raising an unexpected exception for acceptable
identifiers.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Fixes issues with Col and Row.is_valid?

Fixes issues with the methods Col.is_valid? and Row.is_valid? where it
was giving false truths when passed letter Strings to Col.is_valid? and
when passed String numbers to Row.is_valid?

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Integrates work in Row and Col classes into Grid

Rewrites the Grid methods that make use of rows and columns using the
new classes Row and Col functionality

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds Rubaship::Ori and Rubaship::Pos

Initial implementation of Ori and Pos classes to provide helper methods
to the rest of the API.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Improves Pos API with #rangify! and #to_a

Adds Pos#rangify! method and increase the specs documenting its
behaviour.
Minor tweaks to the API

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Adds support to check ship position valid status

Adds Pos#valid? which uses Row#valid? if orientation is vertical and
Col#valid? if it is horizontal. Each method accepts a Fixnum size or a
ship and in the last case uses its size or length to detect if the
position is valid for that ship.
Adds Ship#length as an alias for Ship#size in order to use duck typing
when detecting wether a size of a ship was passed, since a Fixnum
responds to :size.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Changed description of InvalidPositionArgument

Changed error message of InvalidPositionArgument to a more general
description.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>
Improves Pos class to handle position exceptions

Improves Pos.new, Pos.to_a and Pos.is_valid? so that it handles the
generation of exceptions where apropriate.

Signed-off-by: João Soares <jsoaresgeral@gmail.com>