Class: Yeller::Subscriber
- Inherits:
-
Object
- Object
- Yeller::Subscriber
- Defined in:
- lib/yeller/subscriber.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#method ⇒ Object
Returns the value of attribute method.
-
#subscriber_class ⇒ Object
Returns the value of attribute subscriber_class.
Instance Method Summary collapse
- #==(comparison_object) ⇒ Object
-
#initialize(subscriber_class, method, key) ⇒ Subscriber
constructor
A new instance of Subscriber.
- #notify(message) ⇒ Object
Constructor Details
#initialize(subscriber_class, method, key) ⇒ Subscriber
Returns a new instance of Subscriber.
5 6 7 8 9 |
# File 'lib/yeller/subscriber.rb', line 5 def initialize( subscriber_class, method, key ) @subscriber_class = subscriber_class @method = method @key = key end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
3 4 5 |
# File 'lib/yeller/subscriber.rb', line 3 def key @key end |
#method ⇒ Object
Returns the value of attribute method.
3 4 5 |
# File 'lib/yeller/subscriber.rb', line 3 def method @method end |
#subscriber_class ⇒ Object
Returns the value of attribute subscriber_class.
3 4 5 |
# File 'lib/yeller/subscriber.rb', line 3 def subscriber_class @subscriber_class end |
Instance Method Details
#==(comparison_object) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/yeller/subscriber.rb', line 11 def ==( comparison_object ) comparison_object.equal?(self) || ( comparison_object.instance_of?(self.class) && comparison_object.method == method && comparison_object.key == key ) end |
#notify(message) ⇒ Object
18 19 20 21 22 |
# File 'lib/yeller/subscriber.rb', line 18 def notify( ) Thread.new do subscriber_class.send( method, ) end end |