Class: Bricolage::Parameters::DirectValueHandler
- Inherits:
-
Object
- Object
- Bricolage::Parameters::DirectValueHandler
- Defined in:
- lib/bricolage/parameters.rb
Overview
Handles *.job file values. Declarations + values -> IntermediateValues
Instance Method Summary collapse
-
#initialize(decls) ⇒ DirectValueHandler
constructor
A new instance of DirectValueHandler.
-
#parse(values) ⇒ Object
- values
-
=> a.
Constructor Details
#initialize(decls) ⇒ DirectValueHandler
Returns a new instance of DirectValueHandler.
83 84 85 |
# File 'lib/bricolage/parameters.rb', line 83 def initialize(decls) @decls = decls # Declarations end |
Instance Method Details
#parse(values) ⇒ Object
- values
-
=> a
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/bricolage/parameters.rb', line 88 def parse(values) parsed_values = {} vars = Variables.new values.each do |name, value| if decl = @decls[name] val = decl.parse_value(value) # nil is equal to "no option given" semantically parsed_values[name] = val unless val.nil? else vars.add Variable.new(name, value) end end IntermediateValues.new(@decls, parsed_values, vars) end |