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

Instance Method Summary collapse

Instance Attribute Details

#bindingsObject (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, options)
  bindings.each do |bin|
    deserialize_property(bin, doc, options)
  end
  represented
end

#initialize(bindings, represented, options) ⇒ Object



9
10
11
12
# File 'lib/representable/mapper.rb', line 9

def initialize(bindings, represented, options)
  @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, options)
  bindings.each do |bin|
    serialize_property(bin, doc, options)
  end
  doc
end