Class: ActiveSupport::Notifications::Fanout::Subscribers::Timed

Inherits:
Evented
  • Object
show all
Defined in:
activesupport/lib/active_support/notifications/fanout.rb

Instance Method Summary collapse

Methods inherited from Evented

#matches?, #subscribed_to?

Constructor Details

#initialize(pattern, delegate) ⇒ Timed

Returns a new instance of Timed.



110
111
112
113
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 110

def initialize(pattern, delegate)
  @timestack = []
  super
end

Instance Method Details

#finish(name, id, payload) ⇒ Object



123
124
125
126
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 123

def finish(name, id, payload)
  started = @timestack.pop
  @delegate.call(name, started, Time.now, id, payload)
end

#publish(name, *args) ⇒ Object



115
116
117
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 115

def publish(name, *args)
  @delegate.call name, *args
end

#start(name, id, payload) ⇒ Object



119
120
121
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 119

def start(name, id, payload)
  @timestack.push Time.now
end