Class: Crabfarm::EventStore
- Inherits:
-
Object
- Object
- Crabfarm::EventStore
- Defined in:
- lib/crabfarm/event_store.rb
Instance Method Summary collapse
- #event(_category, _message) ⇒ Object
-
#initialize ⇒ EventStore
constructor
A new instance of EventStore.
Constructor Details
#initialize ⇒ EventStore
Returns a new instance of EventStore.
4 5 6 7 |
# File 'lib/crabfarm/event_store.rb', line 4 def initialize @events = [] @mutex = Mutex.new end |
Instance Method Details
#event(_category, _message) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/crabfarm/event_store.rb', line 9 def event(_category, ) @mutex.synchronize do @events << { created_at: Time.current, category: _category, msg: } end end |