Class: Crabfarm::EventStore

Inherits:
Object
  • Object
show all
Defined in:
lib/crabfarm/event_store.rb

Instance Method Summary collapse

Constructor Details

#initializeEventStore

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, _message)
  @mutex.synchronize do
    @events << {
      created_at: Time.current,
      category: _category,
      msg: _message
    }
  end
end