aboutsummaryrefslogtreecommitdiffstats
path: root/board.rb
diff options
context:
space:
mode:
Diffstat (limited to 'board.rb')
-rw-r--r--board.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/board.rb b/board.rb
index 93b726a..c990218 100644
--- a/board.rb
+++ b/board.rb
@@ -10,4 +10,17 @@ class Board
def render
"...\n" * 3
end
+
+ # Raises an ArgumentError if integer conversion fails
+ def transform_coordinates(str)
+ coordinates = str.split(',')
+
+ begin
+ coordinates[0] = Integer(coordinates[0])
+ coordinates[1] = Integer(coordinates[1])
+
+ coordinates if coordinates.length > 1
+ rescue
+ end
+ end
end