Module: EntitySnapshot::Postgres::Controls::Entity::Example::Transformer

Defined in:
lib/entity_snapshot/postgres/controls/entity.rb

Class Method Summary collapse

Class Method Details

.instance(raw_data) ⇒ Object



28
29
30
31
32
33
# File 'lib/entity_snapshot/postgres/controls/entity.rb', line 28

def self.instance(raw_data)
  Example.build({
    :some_attribute => raw_data[:some_attribute],
    :some_time => Clock.parse(raw_data[:some_time])
  })
end

.raw_data(instance) ⇒ Object



21
22
23
24
25
26
# File 'lib/entity_snapshot/postgres/controls/entity.rb', line 21

def self.raw_data(instance)
  {
    :some_attribute => instance.some_attribute,
    :some_time => Clock.iso8601(instance.some_time)
  }
end