Class: RubyEventStore::Mappers::InstrumentedMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby_event_store/mappers/instrumented_mapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(mapper, instrumentation) ⇒ InstrumentedMapper

Returns a new instance of InstrumentedMapper.


6
7
8
9
# File 'lib/ruby_event_store/mappers/instrumented_mapper.rb', line 6

def initialize(mapper, instrumentation)
  @mapper = mapper
  @instrumentation = instrumentation
end

Instance Method Details

#event_to_record(domain_event) ⇒ Object


11
12
13
14
15
# File 'lib/ruby_event_store/mappers/instrumented_mapper.rb', line 11

def event_to_record(domain_event)
  instrumentation.instrument("serialize.mapper.rails_event_store", domain_event: domain_event) do
    mapper.event_to_record(domain_event)
  end
end

#record_to_event(record) ⇒ Object


17
18
19
20
21
# File 'lib/ruby_event_store/mappers/instrumented_mapper.rb', line 17

def record_to_event(record)
  instrumentation.instrument("deserialize.mapper.rails_event_store", record: record) do
    mapper.record_to_event(record)
  end
end