Class: Templator::ParameterFileLoader
- Inherits:
-
Object
- Object
- Templator::ParameterFileLoader
- Defined in:
- lib/templator/parameter_dsl.rb
Overview
Parse a the given files with respect to the Parameter DSL.
Supported DSL methods are :
-
export(hash) : defines a list of parameters from the given hash
-
group(name, block) : defines a group of parameter
-
include_group(name) : include parameters and sub groups the given group into the current group
Example
With the following code :
export :param1 => 'value1'
export :param2 => 'value2', :param3 => 'value3'
group "group1" do
export :param4 => value4
end
group "group2" do
export :param5 => group1.param4
group "group3" do
export :param6 => "value6"
end
end
group "group4" do
include_group "group2.group3"
end
param5 value can retrieved with the following :
p = ParameterFileLoader.new.parse("path/to/parameter_file")
p.group2.param5
Instance Method Summary collapse
-
#parse(*files) ⇒ Object
Parses the given files.
Instance Method Details
#parse(*files) ⇒ Object
Parses the given files
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/templator/parameter_dsl.rb', line 37 def parse(*files) files.each do |file| begin load file rescue ::Exception => e raise ParseError.new(e, file) end end DslContext.top_level_group end |