Class: Bitmapped::Validators::ValidateFillInput

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

Class Method Summary collapse

Class Method Details

.parse_and_validate(input) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bitmapped/validators/validate_fill_input.rb', line 9

def parse_and_validate(input)
  begin
    raise ArgumentError unless input.size == 3

    columns = Integer(input[0])
    rows = Integer(input[1])
    color = ValidationHelper.parse_color(input[2].strip)
    [columns, rows, color]
  rescue ArgumentError => ae
    raise ParsingError
  end
end