Class: SoarConfiguration::ConfigurationValidator
- Inherits:
-
Object
- Object
- SoarConfiguration::ConfigurationValidator
- Defined in:
- lib/soar_configuration/configuration_validator.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ ConfigurationValidator
constructor
A new instance of ConfigurationValidator.
- #validate ⇒ Object
-
#validate_presence(errors) ⇒ Object
IOC to check whether parameters exist.
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
#configuration ⇒ Object (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
#validate ⇒ Object
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 |