Class: GrowlGlue::Config
- Inherits:
-
Object
- Object
- GrowlGlue::Config
- Defined in:
- lib/growl_glue/config.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #method_missing(name, *args, &block) ⇒ Object
-
#option(*keys) ⇒ Object
returns a nested option value.
- #set_options(key, opts) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
6 7 8 |
# File 'lib/growl_glue/config.rb', line 6 def initialize @options={} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
19 20 21 |
# File 'lib/growl_glue/config.rb', line 19 def method_missing(name, *args, &block) self.(name, *args) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/growl_glue/config.rb', line 4 def @options end |
Instance Method Details
#option(*keys) ⇒ Object
returns a nested option value
11 12 13 14 15 16 17 |
# File 'lib/growl_glue/config.rb', line 11 def option(*keys) option = @options until keys.empty? or option.nil? option = option[keys.shift] end option end |
#set_options(key, opts) ⇒ Object
23 24 25 26 |
# File 'lib/growl_glue/config.rb', line 23 def (key, opts) @options[key] ||= {} @options[key].merge!(opts) end |