Module: Representable::Mapper::Methods
- Included in:
- Representable::Mapper
- Defined in:
- lib/representable/mapper.rb
Overview
DISCUSS: we need @represented here for evaluating the :if blocks. this could be done in the bindings_for asset.
Instance Attribute Summary collapse
-
#bindings ⇒ Object
readonly
Returns the value of attribute bindings.
Instance Method Summary collapse
- #deserialize(doc, options) ⇒ Object
- #initialize(bindings, represented, options) ⇒ Object
- #serialize(doc, options) ⇒ Object
Instance Attribute Details
#bindings ⇒ Object (readonly)
Returns the value of attribute bindings.
14 15 16 |
# File 'lib/representable/mapper.rb', line 14 def bindings @bindings end |
Instance Method Details
#deserialize(doc, options) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/representable/mapper.rb', line 16 def deserialize(doc, ) bindings.each do |bin| deserialize_property(bin, doc, ) end represented end |
#initialize(bindings, represented, options) ⇒ Object
9 10 11 12 |
# File 'lib/representable/mapper.rb', line 9 def initialize(bindings, represented, ) @represented = represented # the (extended) model. @bindings = bindings end |
#serialize(doc, options) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/representable/mapper.rb', line 23 def serialize(doc, ) bindings.each do |bin| serialize_property(bin, doc, ) end doc end |