Class: ConfConf::Configuration
- Inherits:
-
Object
- Object
- ConfConf::Configuration
- Defined in:
- lib/conf_conf.rb
Instance Attribute Summary collapse
-
#parsed_values ⇒ Object
readonly
Returns the value of attribute parsed_values.
Instance Method Summary collapse
- #config(key, options = {}) ⇒ Object
-
#initialize(&block) ⇒ Configuration
constructor
A new instance of Configuration.
- #run(block) ⇒ Object
Constructor Details
#initialize(&block) ⇒ Configuration
Returns a new instance of Configuration.
26 27 28 29 |
# File 'lib/conf_conf.rb', line 26 def initialize(&block) @parsed_values = {} run(block) if block end |
Instance Attribute Details
#parsed_values ⇒ Object (readonly)
Returns the value of attribute parsed_values.
24 25 26 |
# File 'lib/conf_conf.rb', line 24 def parsed_values @parsed_values end |
Instance Method Details
#config(key, options = {}) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/conf_conf.rb', line 35 def config(key, ={}) value = Reference.new(key, ).value if block_given? value = yield(value) end @parsed_values[key] = value end |
#run(block) ⇒ Object
31 32 33 |
# File 'lib/conf_conf.rb', line 31 def run(block) instance_eval(&block) end |