Class: ROM::Mapper::Dumper

Inherits:
Object
  • Object
show all
Includes:
Adamantium
Defined in:
lib/rom/mapper/dumper.rb

Overview

Dumps an object back into a tuple

Instance Method Summary collapse

Instance Method Details

#call(object) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
# File 'lib/rom/mapper/dumper.rb', line 13

def call(object)
  header.each_with_object([]) { |attribute, tuple|
    tuple << object.send(attribute.name)
  }
end

#identity(object) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/rom/mapper/dumper.rb', line 20

def identity(object)
  header.keys.map { |key| object.send("#{key.name}") }
end