Class: ActiveSupport::Notifications::Fanout::Subscribers::Evented
- Defined in:
 - lib/active_support/notifications/fanout.rb
 
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
- 
  
    
      #delegate  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute delegate.
 - 
  
    
      #pattern  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute pattern.
 - 
  
    
      #silenceable  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute silenceable.
 
Instance Method Summary collapse
- #group_class ⇒ Object
 - 
  
    
      #initialize(pattern, delegate)  ⇒ Evented 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Evented.
 - #publish ⇒ Object
 - #publish_event(event) ⇒ Object
 - #silenced?(name) ⇒ Boolean
 - #subscribed_to?(name) ⇒ Boolean
 - #unsubscribe!(name) ⇒ Object
 
Constructor Details
#initialize(pattern, delegate) ⇒ Evented
Returns a new instance of Evented.
      400 401 402 403 404 405 406  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 400 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 ⇒ Object (readonly)
Returns the value of attribute delegate.
      398 399 400  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 398 def delegate @delegate end  | 
  
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
      398 399 400  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 398 def pattern @pattern end  | 
  
#silenceable ⇒ Object (readonly)
Returns the value of attribute silenceable.
      398 399 400  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 398 def silenceable @silenceable end  | 
  
Instance Method Details
#group_class ⇒ Object
      408 409 410  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 408 def group_class EventedGroup end  | 
  
#publish ⇒ Object
      412 413 414 415 416  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 412 def publish(...) if @can_publish @delegate.publish(...) end end  | 
  
#publish_event(event) ⇒ Object
      418 419 420 421 422 423 424  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 418 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
      426 427 428  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 426 def silenced?(name) @silenceable && @delegate.silenced?(name) end  | 
  
#subscribed_to?(name) ⇒ Boolean
      430 431 432  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 430 def subscribed_to?(name) pattern === name end  | 
  
#unsubscribe!(name) ⇒ Object
      434 435 436  | 
    
      # File 'lib/active_support/notifications/fanout.rb', line 434 def unsubscribe!(name) pattern.unsubscribe!(name) end  |