Class: Bitmapped::Validators::ValidateCoordinates

Inherits:
Object
  • Object
show all
Defined in:
lib/bitmapped/validators/validate_coordinates.rb

Class Method Summary collapse

Class Method Details

.parse_and_validate(bitmap, input) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/bitmapped/validators/validate_coordinates.rb', line 8

def parse_and_validate(bitmap, input)
  begin
    row = Integer(input[0])
    column = Integer(input[1])
    raise InvalidCoordinatesError unless bitmap.pixels[row][column]
  rescue NoMethodError => nme
    raise InvalidCoordinatesError
  end
end