Class: TestProf::EventProf::Instrumentations::ActiveSupport::Subscriber

Inherits:
Object
  • Object
show all
Defined in:
lib/test_prof/event_prof/instrumentations/active_support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Subscriber

Returns a new instance of Subscriber.



10
11
12
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 10

def initialize(block)
  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



8
9
10
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 8

def block
  @block
end

#started_atObject (readonly)

Returns the value of attribute started_at.



8
9
10
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 8

def started_at
  @started_at
end

Instance Method Details

#finishObject



22
23
24
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 22

def finish(*)
  block.call(TestProf.now - started_at)
end

#publish(_name, started_at, finished_at) ⇒ Object



18
19
20
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 18

def publish(_name, started_at, finished_at, *)
  block.call(finished_at - started_at)
end

#startObject



14
15
16
# File 'lib/test_prof/event_prof/instrumentations/active_support.rb', line 14

def start(*)
  @started_at = TestProf.now
end