Sha256: 75b5bb88120574de4ddb60d62081b42179dc566c6935bc6ee4a32f90031ba8a8

Contents?: true

Size: 650 Bytes

Versions: 2

Compression:

Stored size: 650 Bytes

Contents

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

module Bitmapped
  module Validators
    class ValidateSegmentInput
      class << self
        def parse_and_validate(input)
          begin
            raise ArgumentError unless input.size == 4

            segement_a = Integer(input[0])
            segement_b = Integer(input[1])
            segement_c = Integer(input[2])
            color = ValidationHelper.parse_color(input[3].strip)
            [segement_a, segement_b, segement_c, 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_segment_input.rb
bitmapped-0.1.0 lib/bitmapped/validators/validate_segment_input.rb