Module: NPlusInsight::Store

Defined in:
lib/n_plus_insight/store.rb

Class Method Summary collapse

Class Method Details

.add(event) ⇒ Object



9
10
11
12
13
14
# File 'lib/n_plus_insight/store.rb', line 9

def add(event)
  @lock.synchronize do
    @events.unshift(event)
    @events = @events.first(NPlusInsight.configuration.max_events)
  end
end

.allObject



16
# File 'lib/n_plus_insight/store.rb', line 16

def all = @lock.synchronize { @events.dup }

.clearObject



18
# File 'lib/n_plus_insight/store.rb', line 18

def clear = @lock.synchronize { @events.clear }

.find(id) ⇒ Object



17
# File 'lib/n_plus_insight/store.rb', line 17

def find(id) = @lock.synchronize { @events.find { |event| event.id == id } }