Class: ActiveSupport::Notifications::Fanout::Subscribers::Matcher
- Defined in:
- lib/active_support/notifications/fanout.rb
Overview
:nodoc:
Defined Under Namespace
Classes: AllMessages
Instance Attribute Summary collapse
-
#exclusions ⇒ Object
readonly
Returns the value of attribute exclusions.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
Class Method Summary collapse
Instance Method Summary collapse
- #===(name) ⇒ Object
-
#initialize(pattern) ⇒ Matcher
constructor
A new instance of Matcher.
- #unsubscribe!(name) ⇒ Object
Constructor Details
#initialize(pattern) ⇒ Matcher
Returns a new instance of Matcher.
373 374 375 376 |
# File 'lib/active_support/notifications/fanout.rb', line 373 def initialize(pattern) @pattern = pattern @exclusions = Set.new end |
Instance Attribute Details
#exclusions ⇒ Object (readonly)
Returns the value of attribute exclusions.
361 362 363 |
# File 'lib/active_support/notifications/fanout.rb', line 361 def exclusions @exclusions end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
361 362 363 |
# File 'lib/active_support/notifications/fanout.rb', line 361 def pattern @pattern end |
Class Method Details
.wrap(pattern) ⇒ Object
363 364 365 366 367 368 369 370 371 |
# File 'lib/active_support/notifications/fanout.rb', line 363 def self.wrap(pattern) if String === pattern pattern elsif pattern.nil? AllMessages.new else new(pattern) end end |
Instance Method Details
#===(name) ⇒ Object
382 383 384 |
# File 'lib/active_support/notifications/fanout.rb', line 382 def ===(name) pattern === name && !exclusions.include?(name) end |
#unsubscribe!(name) ⇒ Object
378 379 380 |
# File 'lib/active_support/notifications/fanout.rb', line 378 def unsubscribe!(name) exclusions << -name if pattern === name end |