Class: ActiveSupport::Notifications::Fanout::Subscribers::Evented

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

Overview

:nodoc:

Direct Known Subclasses

Timed

Instance Method Summary collapse

Constructor Details

#initialize(pattern, delegate) ⇒ Evented

Returns a new instance of Evented.



87
88
89
90
91
# File 'lib/active_support/notifications/fanout.rb', line 87

def initialize(pattern, delegate)
  @pattern = pattern
  @delegate = delegate
  @can_publish = delegate.respond_to?(:publish)
end

Instance Method Details

#finish(name, id, payload) ⇒ Object



103
104
105
# File 'lib/active_support/notifications/fanout.rb', line 103

def finish(name, id, payload)
  @delegate.finish name, id, payload
end

#matches?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

def matches?(name)
  @pattern && @pattern === name
end

#publish(name, *args) ⇒ Object



93
94
95
96
97
# File 'lib/active_support/notifications/fanout.rb', line 93

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

#start(name, id, payload) ⇒ Object



99
100
101
# File 'lib/active_support/notifications/fanout.rb', line 99

def start(name, id, payload)
  @delegate.start name, id, payload
end

#subscribed_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


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

def subscribed_to?(name)
  @pattern === name
end