Module: Sufia::WithEvents
- Included in:
- FileSetBehavior, FileSetPresenter, WorkBehavior
- Defined in:
- app/models/concerns/sufia/with_events.rb
Instance Method Summary collapse
- #event_class ⇒ Object
- #event_store ⇒ Object
- #events(size = -1)) ⇒ Object
- #log_event(event_id) ⇒ Object
- #stream ⇒ Object
Instance Method Details
#event_class ⇒ Object
7 8 9 |
# File 'app/models/concerns/sufia/with_events.rb', line 7 def event_class self.class.name end |
#event_store ⇒ Object
11 12 13 |
# File 'app/models/concerns/sufia/with_events.rb', line 11 def event_store RedisEventStore end |
#events(size = -1)) ⇒ Object
15 16 17 |
# File 'app/models/concerns/sufia/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/sufia/with_events.rb', line 19 def log_event(event_id) event_store.for(stream[:event]).push(event_id) end |
#stream ⇒ Object
3 4 5 |
# File 'app/models/concerns/sufia/with_events.rb', line 3 def stream Nest.new(event_class)[to_param] end |