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.



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

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

Instance Method Details

#events_to_records(events) ⇒ Object



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

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

#records_to_events(records) ⇒ Object



25
26
27
28
29
30
31
# File 'lib/ruby_event_store/mappers/instrumented_batch_mapper.rb', line 25

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