Class: Filegen::Data
- Inherits:
-
Object
- Object
- Filegen::Data
- Defined in:
- lib/filegen/data.rb
Overview
This class is used as context for the erb-template
Instance Method Summary collapse
-
#initialize(data_sources) ⇒ Data
constructor
Create context class.
-
#instance_binding ⇒ Binding
Make the binding of the class available.
-
#lookup(variable, default_value = '') ⇒ String
Lookup a variable within the data sources.
Constructor Details
#initialize(data_sources) ⇒ Data
Create context class
16 17 18 |
# File 'lib/filegen/data.rb', line 16 def initialize(data_sources) @data_sources = Array(data_sources) end |
Instance Method Details
#instance_binding ⇒ Binding
Make the binding of the class available
32 33 34 |
# File 'lib/filegen/data.rb', line 32 def instance_binding binding end |
#lookup(variable, default_value = '') ⇒ String
Lookup a variable within the data sources
26 27 28 |
# File 'lib/filegen/data.rb', line 26 def lookup(variable, default_value = '') try_to_fetch_unless_found_or_end(variable) || default_value end |