Module: Sufia::WithEvents

Included in:
FileSetBehavior, WorkBehavior
Defined in:
app/models/concerns/sufia/with_events.rb

Instance Method Summary collapse

Instance Method Details

#event_storeObject



7
8
9
# File 'app/models/concerns/sufia/with_events.rb', line 7

def event_store
  RedisEventStore
end

#events(size = -1)) ⇒ Object



11
12
13
# File 'app/models/concerns/sufia/with_events.rb', line 11

def events(size = -1)
  event_store.for(stream[:event]).fetch(size)
end

#log_event(event_id) ⇒ Object



15
16
17
# File 'app/models/concerns/sufia/with_events.rb', line 15

def log_event(event_id)
  event_store.for(stream[:event]).push(event_id)
end

#streamObject



3
4
5
# File 'app/models/concerns/sufia/with_events.rb', line 3

def stream
  Nest.new(self.class.name)[to_param]
end