Class: Lavender::Config::OpenStruct
- Inherits:
-
Object
- Object
- Lavender::Config::OpenStruct
- Defined in:
- lib/lavender/config.rb
Instance Method Summary collapse
-
#initialize(hsh) ⇒ OpenStruct
constructor
A new instance of OpenStruct.
- #method_missing(method) ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(hsh) ⇒ OpenStruct
Returns a new instance of OpenStruct.
13 14 15 |
# File 'lib/lavender/config.rb', line 13 def initialize(hsh) @hsh = hsh end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/lavender/config.rb', line 5 def method_missing(method) method = method.to_s if @hsh[method].is_a? Hash OpenStruct.new(@hsh[method]) else @hsh[method] end end |
Instance Method Details
#to_hash ⇒ Object
16 17 18 |
# File 'lib/lavender/config.rb', line 16 def to_hash @hsh end |