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

Inherits:
Evented
  • Object
show all
Defined in:
lib/skylight/vendor/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.

[View source]

114
115
116
117
# File 'lib/skylight/vendor/active_support/notifications/fanout.rb', line 114

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

Instance Method Details

#finish(name, id, payload) ⇒ Object

[View source]

127
128
129
130
# File 'lib/skylight/vendor/active_support/notifications/fanout.rb', line 127

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

#publish(name, *args) ⇒ Object

[View source]

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

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

#start(name, id, payload) ⇒ Object

[View source]

123
124
125
# File 'lib/skylight/vendor/active_support/notifications/fanout.rb', line 123

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