Sha256: 8130687fff5b8366646b55ed9cef18bee91d3ff9b80a700be003318a6159b1ea

Contents?: true

Size: 575 Bytes

Versions: 2

Compression:

Stored size: 575 Bytes

Contents

require 'bitmapped/exceptions'
require 'bitmapped/validators/validation_helper'

module Bitmapped
  module Validators
    class ValidateFillInput

      class << self
        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
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bitmapped-0.2.0 lib/bitmapped/validators/validate_fill_input.rb
bitmapped-0.1.0 lib/bitmapped/validators/validate_fill_input.rb