Class: PincasterPin
- Inherits:
-
Object
- Object
- PincasterPin
- Defined in:
- lib/pincaster_pin.rb
Instance Attribute Summary collapse
-
#pin_hash ⇒ Object
readonly
Returns the value of attribute pin_hash.
Instance Method Summary collapse
-
#id ⇒ Object
returns the ActiveRecord:id of this pin’s matching ActiveRecord object.
-
#initialize(pin_hash) ⇒ PincasterPin
constructor
A new instance of PincasterPin.
-
#splat_pin ⇒ Object
provides an accessor for every pin value that came back from Pincaster.
Constructor Details
#initialize(pin_hash) ⇒ PincasterPin
Returns a new instance of PincasterPin.
5 6 7 8 |
# File 'lib/pincaster_pin.rb', line 5 def initialize(pin_hash) @pin_hash = pin_hash splat_pin end |
Instance Attribute Details
#pin_hash ⇒ Object (readonly)
Returns the value of attribute pin_hash.
3 4 5 |
# File 'lib/pincaster_pin.rb', line 3 def pin_hash @pin_hash end |
Instance Method Details
#id ⇒ Object
returns the ActiveRecord:id of this pin’s matching ActiveRecord object
19 20 21 |
# File 'lib/pincaster_pin.rb', line 19 def id key end |
#splat_pin ⇒ Object
provides an accessor for every pin value that came back from Pincaster
11 12 13 14 15 16 |
# File 'lib/pincaster_pin.rb', line 11 def splat_pin @pin_hash.each_pair do |key, value| self.class.send(:attr_accessor, key.to_sym) self.send(key.to_s + "=", value) end end |