Class: StackMaster::SparkleFormation::CompileTime::ParametersValidator
- Inherits:
-
Object
- Object
- StackMaster::SparkleFormation::CompileTime::ParametersValidator
- Defined in:
- lib/stack_master/sparkle_formation/compile_time/parameters_validator.rb
Instance Method Summary collapse
-
#initialize(definitions, parameters) ⇒ ParametersValidator
constructor
A new instance of ParametersValidator.
- #validate ⇒ Object
Constructor Details
permalink #initialize(definitions, parameters) ⇒ ParametersValidator
Returns a new instance of ParametersValidator.
8 9 10 11 |
# File 'lib/stack_master/sparkle_formation/compile_time/parameters_validator.rb', line 8 def initialize(definitions, parameters) @definitions = definitions @parameters = parameters end |
Instance Method Details
permalink #validate ⇒ Object
[View source]
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/stack_master/sparkle_formation/compile_time/parameters_validator.rb', line 13 def validate @definitions.each do |name, definition| parameter = @parameters[name.to_s.camelize] factory = ValueValidatorFactory.new(name, definition, parameter) value_validators = factory.build value_validators.each do |validator| validator.validate raise ArgumentError.new "Invalid compile time parameter: #{validator.error}" unless validator.is_valid end end end |