123456789_123456789_123456789_123456789_123456789_

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

Do not use. This class is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: activesupport/lib/active_support/notifications/fanout.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(pattern, delegate) ⇒ Evented

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 378

def initialize(pattern, delegate)
  @pattern = Matcher.wrap(pattern)
  @delegate = delegate
  @silenceable = delegate.respond_to?(:silenced?)
  @can_publish = delegate.respond_to?(:publish)
  @can_publish_event = delegate.respond_to?(:publish_event)
end

Instance Attribute Details

#delegate (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 376

attr_reader :pattern, :delegate, :silenceable

#pattern (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 376

attr_reader :pattern, :delegate, :silenceable

#silenceable (readonly)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 376

attr_reader :pattern, :delegate, :silenceable

Instance Method Details

#group_class

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 386

def group_class
  EventedGroup
end

#publish(name, *args)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 390

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

#publish_event(event)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 396

def publish_event(event)
  if @can_publish_event
    @delegate.publish_event event
  else
    publish(event.name, event.time, event.end, event.transaction_id, event.payload)
  end
end

#silenced?(name) ⇒ Boolean

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 404

def silenced?(name)
  @silenceable && @delegate.silenced?(name)
end

#subscribed_to?(name) ⇒ Boolean

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 408

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

#unsubscribe!(name)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 412

def unsubscribe!(name)
  pattern.unsubscribe!(name)
end