Class: Hyperdrive::Instrumenters::Memory

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperdrive/instrumenters/memory.rb

Defined Under Namespace

Classes: Event

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMemory

Returns a new instance of Memory.



10
11
12
# File 'lib/hyperdrive/instrumenters/memory.rb', line 10

def initialize
  @events = []
end

Instance Attribute Details

#eventsObject (readonly)

Returns the value of attribute events.



8
9
10
# File 'lib/hyperdrive/instrumenters/memory.rb', line 8

def events
  @events
end

Instance Method Details

#instrument(name, payload = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hyperdrive/instrumenters/memory.rb', line 14

def instrument(name, payload = {})
  result = if block_given?
    yield payload
  else
    payload
  end

  @events << Event.new(name, payload, result)

  result
end