Class: ConfConf::Configuration
- Inherits:
-
Object
- Object
- ConfConf::Configuration
- Defined in:
- lib/conf_conf/configuration.rb
Instance Attribute Summary collapse
-
#parsed_values ⇒ Object
readonly
Returns the value of attribute parsed_values.
-
#references ⇒ Object
readonly
Returns the value of attribute references.
Instance Method Summary collapse
- #config(key, options = {}) ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #run(block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
6 7 8 9 |
# File 'lib/conf_conf/configuration.rb', line 6 def initialize @parsed_values = {} @references = {} end |
Instance Attribute Details
#parsed_values ⇒ Object (readonly)
Returns the value of attribute parsed_values.
3 4 5 |
# File 'lib/conf_conf/configuration.rb', line 3 def parsed_values @parsed_values end |
#references ⇒ Object (readonly)
Returns the value of attribute references.
4 5 6 |
# File 'lib/conf_conf/configuration.rb', line 4 def references @references end |
Instance Method Details
#config(key, options = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/conf_conf/configuration.rb', line 15 def config(key, ={}) reference = Reference.new(key, ) @references[reference.environment_key] = reference value = reference.value if block_given? value = yield(value) end @parsed_values[key] = value end |
#run(block) ⇒ Object
11 12 13 |
# File 'lib/conf_conf/configuration.rb', line 11 def run(block) instance_eval(&block) end |