Class: Funes::PersistProjectionJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/funes/persist_projection_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(event_stream, projection_class, as_of = nil, at = nil) ⇒ Object



3
4
5
6
# File 'app/jobs/funes/persist_projection_job.rb', line 3

def perform(event_stream, projection_class, as_of = nil, at = nil)
  events = as_of ? event_stream.events.select { |e| e.created_at <= as_of } : event_stream.events
  projection_class.materialize!(events, event_stream.idx, at: at)
end