Class: RubyEventStore::Mappers::InstrumentedBatchMapper

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

Instance Method Summary collapse

Constructor Details

#initialize(mapper, instrumentation) ⇒ InstrumentedBatchMapper

Returns a new instance of InstrumentedBatchMapper.



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

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

Instance Method Details

#events_to_records(events) ⇒ Object



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

def events_to_records(events)
  instrumentation.instrument("events_to_records.mapper.rails_event_store", domain_events: events) do
    mapper.events_to_records(events)
  end
end

#records_to_events(records) ⇒ Object



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

def records_to_events(records)
  instrumentation.instrument("records_to_events.mapper.rails_event_store", records: records) do
    mapper.records_to_events(records)
  end
end