Class: Templator::Parameters
- Inherits:
-
Object
- Object
- Templator::Parameters
- Defined in:
- lib/templator/parameters.rb
Class Method Summary collapse
-
.load_files(*paths) ⇒ Parameters
Loads parameter files from given paths.
Instance Method Summary collapse
-
#get(var) ⇒ Object
Retrieves the value of a variable defined in the parameter files previously loaded.
-
#load(files) ⇒ Object
Loads parameters from provided files.
Class Method Details
.load_files(*paths) ⇒ Parameters
Loads parameter files from given paths.
19 20 21 22 23 24 25 26 |
# File 'lib/templator/parameters.rb', line 19 def self.load_files(*paths) files = ParameterFileSelector.select_parameter_files(*paths) parameters = Parameters.new parameters.load(files) return parameters end |
Instance Method Details
#get(var) ⇒ Object
Retrieves the value of a variable defined in the parameter files previously loaded.
31 32 33 |
# File 'lib/templator/parameters.rb', line 31 def get(var) var.to_s.split('.').inject(@parameters) {|result, element| result.send(element)} end |
#load(files) ⇒ Object
Loads parameters from provided files.
37 38 39 |
# File 'lib/templator/parameters.rb', line 37 def load(files) @parameters = Templator::ParameterFileLoader.new.parse(*files) end |