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



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

def bindings
  @bindings
end

Instance Method Details

#deserialize(doc, options) ⇒ Object



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

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.



6
7
8
9
# File 'lib/representable/mapper.rb', line 6

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

#serialize(doc, options) ⇒ Object



20
21
22
23
24
25
# File 'lib/representable/mapper.rb', line 20

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