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.



85
86
87
88
89
# File 'lib/active_support/notifications/fanout.rb', line 85

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

Instance Method Details

#finish(name, id, payload) ⇒ Object



101
102
103
# File 'lib/active_support/notifications/fanout.rb', line 101

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

#matches?(name) ⇒ Boolean

Returns:

  • (Boolean)


109
110
111
# File 'lib/active_support/notifications/fanout.rb', line 109

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

#publish(name, *args) ⇒ Object



91
92
93
94
95
# File 'lib/active_support/notifications/fanout.rb', line 91

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

#start(name, id, payload) ⇒ Object



97
98
99
# File 'lib/active_support/notifications/fanout.rb', line 97

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

#subscribed_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


105
106
107
# File 'lib/active_support/notifications/fanout.rb', line 105

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