Class: Quark::Subscription
- Inherits:
-
Object
- Object
- Quark::Subscription
- Defined in:
- lib/quark/subscription.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
Instance Method Summary collapse
- #<<(pattern) ⇒ Object
- #add_pattern(pattern) ⇒ Object
-
#initialize(options = {}) ⇒ Subscription
constructor
A new instance of Subscription.
Constructor Details
#initialize(options = {}) ⇒ Subscription
Returns a new instance of Subscription.
5 6 7 8 |
# File 'lib/quark/subscription.rb', line 5 def initialize(={}) @channel = ([:channel] || :default).to_sym @patterns = [*([:patterns] || [])].uniq end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
3 4 5 |
# File 'lib/quark/subscription.rb', line 3 def channel @channel end |
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
3 4 5 |
# File 'lib/quark/subscription.rb', line 3 def patterns @patterns end |
Instance Method Details
#<<(pattern) ⇒ Object
14 15 16 |
# File 'lib/quark/subscription.rb', line 14 def <<(pattern) add_pattern(pattern) end |
#add_pattern(pattern) ⇒ Object
10 11 12 |
# File 'lib/quark/subscription.rb', line 10 def add_pattern(pattern) @patterns << pattern unless @patterns.include?(pattern) end |