Class: OpenStruct
- Inherits:
-
Object
- Object
- OpenStruct
- Defined in:
- lib/cali.rb
Instance Attribute Summary collapse
-
#hsh ⇒ Object
readonly
Returns the value of attribute hsh.
Instance Method Summary collapse
-
#initialize ⇒ OpenStruct
constructor
A new instance of OpenStruct.
- #method_missing(method, value = nil) ⇒ Object
Constructor Details
#initialize ⇒ OpenStruct
Returns a new instance of OpenStruct.
31 32 33 |
# File 'lib/cali.rb', line 31 def initialize @hsh = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, value = nil) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/cali.rb', line 23 def method_missing(method, value = nil) method = method.to_s if method.match(/^(.*)=$/) @hsh[$1] = value else @hsh[method] end end |
Instance Attribute Details
#hsh ⇒ Object (readonly)
Returns the value of attribute hsh.
22 23 24 |
# File 'lib/cali.rb', line 22 def hsh @hsh end |