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
16
17
# File 'lib/ruby_event_store/mappers/instrumented_batch_mapper.rb', line 11

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



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

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