Class: RubyEventStore::Transformations::WithIndifferentAccess

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/transformations/with_indifferent_access.rb

Instance Method Summary collapse

Instance Method Details

#dump(record) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/ruby_event_store/transformations/with_indifferent_access.rb', line 10

def dump(record)
  Record.new(
    event_id:   record.event_id,
    metadata:   record..deep_symbolize_keys,
    data:       record.data.deep_symbolize_keys,
    event_type: record.event_type,
    timestamp:  record.timestamp,
    valid_at:   record.valid_at,
  )
end

#load(record) ⇒ Object



21
22
23
24
25
26
27
28
29
30
# File 'lib/ruby_event_store/transformations/with_indifferent_access.rb', line 21

def load(record)
  Record.new(
    event_id:   record.event_id,
    metadata:   HashWithIndifferentAccess.new(record.),
    data:       HashWithIndifferentAccess.new(record.data),
    event_type: record.event_type,
    timestamp:  record.timestamp,
    valid_at:   record.valid_at,
  )
end