Class: AS::Notifications::Fanout::Subscribers::Timed

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



107
108
109
110
# File 'lib/as/notifications/fanout.rb', line 107

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

Instance Method Details

#finish(name, id, payload) ⇒ Object



120
121
122
123
# File 'lib/as/notifications/fanout.rb', line 120

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

#publish(name, *args) ⇒ Object



112
113
114
# File 'lib/as/notifications/fanout.rb', line 112

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

#start(name, id, payload) ⇒ Object



116
117
118
# File 'lib/as/notifications/fanout.rb', line 116

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