Class: SoarConfiguration::ConfigurationValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/soar_configuration/configuration_validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ ConfigurationValidator

Returns a new instance of ConfigurationValidator.



4
5
6
# File 'lib/soar_configuration/configuration_validator.rb', line 4

def initialize(configuration)
  @configuration = configuration
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



3
4
5
# File 'lib/soar_configuration/configuration_validator.rb', line 3

def configuration
  @configuration
end

Instance Method Details

#validateObject



8
9
10
11
12
13
# File 'lib/soar_configuration/configuration_validator.rb', line 8

def validate
  errors = []
  errors << 'invalid configuration' if not @configuration.is_a?(Hash)
  errors = validate_presence(errors)
  errors
end

#validate_presence(errors) ⇒ Object

IOC to check whether parameters exist



16
17
18
19
20
# File 'lib/soar_configuration/configuration_validator.rb', line 16

def validate_presence(errors)
  #errors = validate_exists(@configuration['providers'], "providers", errors)
  #errors = validate_exists(@configuration['providers']['products'], "products")
  errors
end