Class: StaticConfig::ConfigHash
- Inherits:
-
Object
- Object
- StaticConfig::ConfigHash
- Defined in:
- lib/static_config/config_hash.rb
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(data) ⇒ ConfigHash
constructor
A new instance of ConfigHash.
- #method_missing(attr, *args) ⇒ Object
Constructor Details
#initialize(data) ⇒ ConfigHash
Returns a new instance of ConfigHash.
3 4 5 |
# File 'lib/static_config/config_hash.rb', line 3 def initialize(data) @data = data end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(attr, *args) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/static_config/config_hash.rb', line 7 def method_missing(attr, *args) case value = @data[attr.to_s] when Hash ConfigHash.new value else value end end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/static_config/config_hash.rb', line 16 def ==(other) super || @data == other end |