Class: ActiveWrapper::Gems::SimpleStruct
- Inherits:
-
Object
- Object
- ActiveWrapper::Gems::SimpleStruct
- Defined in:
- lib/active_wrapper/gems.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(hash) ⇒ SimpleStruct
constructor
A new instance of SimpleStruct.
Constructor Details
#initialize(hash) ⇒ SimpleStruct
Returns a new instance of SimpleStruct.
14 15 16 17 18 19 20 |
# File 'lib/active_wrapper/gems.rb', line 14 def initialize(hash) @hash = hash @hash.each do |key, value| self.class.send(:define_method, key) { hash[key] } self.class.send(:define_method, "#{key}=") { |v| hash[key] = v } end end |
Instance Attribute Details
#hash ⇒ Object
Returns the value of attribute hash.
12 13 14 |
# File 'lib/active_wrapper/gems.rb', line 12 def hash @hash end |