Module: Philiprehberger::AuditTrail::Batchable

Included in:
Tracker
Defined in:
lib/philiprehberger/audit_trail/batchable.rb

Overview

Batch recording support for multiple audit events.

Instance Method Summary collapse

Instance Method Details

#record_batch(entries) ⇒ Array<Event>

Record multiple events in one call.

Parameters:

  • entries (Array<Hash>)

    array of event attribute hashes

Returns:

  • (Array<Event>)

    the recorded events



11
12
13
14
# File 'lib/philiprehberger/audit_trail/batchable.rb', line 11

def record_batch(entries)
  events = entries.map { |entry| Event.new(**entry) }
  @store.push_all(events)
end