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