Class: GeoPattern::PatternValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/geo_pattern/pattern_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(pattern_store = PatternStore.new) ⇒ PatternValidator

Returns a new instance of PatternValidator


9
10
11
# File 'lib/geo_pattern/pattern_validator.rb', line 9

def initialize(pattern_store = PatternStore.new)
  @pattern_store = pattern_store
end

Instance Method Details

#validate(requested_patterns) ⇒ Object


13
14
15
16
17
18
19
# File 'lib/geo_pattern/pattern_validator.rb', line 13

def validate(requested_patterns)
  message = "Error: At least one of the requested patterns \"#{requested_patterns.join(', ')}\" is invalid"

  raise InvalidPatternError, message unless valid?(requested_patterns)

  self
end