Module: Representable::Mapper::Methods

Included in:
Representable::Mapper
Defined in:
lib/representable/mapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bindingsObject (readonly)

Returns the value of attribute bindings.



13
14
15
# File 'lib/representable/mapper.rb', line 13

def bindings
  @bindings
end

Instance Method Details

#deserialize(doc, options) ⇒ Object



15
16
17
18
19
20
# File 'lib/representable/mapper.rb', line 15

def deserialize(doc, options)
  bindings.each do |bin|
    deserialize_property(bin, doc, options)
  end
  @represented
end

#initialize(bindings, represented, options) ⇒ Object

TODO: get rid of represented dependency.



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

def initialize(bindings, represented, options) # TODO: get rid of represented dependency.
  @represented  = represented # the (extended) model.
  @bindings     = bindings
end

#serialize(doc, options) ⇒ Object



22
23
24
25
26
27
# File 'lib/representable/mapper.rb', line 22

def serialize(doc, options)
  bindings.each do |bin|
    serialize_property(bin, doc, options)
  end
  doc
end