Class: Puggernaut::Gems::SimpleStruct
- Inherits:
-
Object
- Object
- Puggernaut::Gems::SimpleStruct
- Defined in:
- lib/puggernaut/gems.rb
Instance Attribute Summary collapse
-
#hash ⇒ Object
readonly
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.
15 16 17 18 19 20 21 |
# File 'lib/puggernaut/gems.rb', line 15 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 (readonly)
Returns the value of attribute hash.
13 14 15 |
# File 'lib/puggernaut/gems.rb', line 13 def hash @hash end |