Module: Representable::Mapper::Methods

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

Instance Method Summary collapse

Instance Method Details

#bindings(represented, options) ⇒ Object



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

def bindings(represented, options)
  @bindings.each do |binding|
    binding.update!(represented, options)
  end
end

#deserialize(represented, doc, options, private_options) ⇒ Object



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

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

#initialize(bindings) ⇒ Object



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

def initialize(bindings)
  @bindings = bindings
end

#serialize(represented, doc, options, private_options) ⇒ Object



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

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