Module: Hyrax::WithEvents

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

Instance Method Summary collapse

Instance Method Details

#event_classObject



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

def event_class
  self.class.name
end

#event_storeObject



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

def event_store
  RedisEventStore
end

#events(size = -1)) ⇒ Object



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

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

#log_event(event_id) ⇒ Object



19
20
21
# File 'app/models/concerns/hyrax/with_events.rb', line 19

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

#streamObject



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

def stream
  Nest.new(event_class)[to_param]
end