Class: Faye::Subscription
- Inherits:
-
Object
- Object
- Faye::Subscription
- Defined in:
- lib/faye/protocol/subscription.rb
Instance Method Summary collapse
- #cancel ⇒ Object
-
#initialize(client, channels, callback) ⇒ Subscription
constructor
A new instance of Subscription.
- #unsubscribe ⇒ Object
Constructor Details
#initialize(client, channels, callback) ⇒ Subscription
Returns a new instance of Subscription.
4 5 6 7 8 9 |
# File 'lib/faye/protocol/subscription.rb', line 4 def initialize(client, channels, callback) @client = client @channels = channels @callback = callback @cancelled = false end |
Instance Method Details
#cancel ⇒ Object
11 12 13 14 15 |
# File 'lib/faye/protocol/subscription.rb', line 11 def cancel return if @cancelled @client.unsubscribe(@channels, &@callback) @cancelled = true end |
#unsubscribe ⇒ Object
17 18 19 |
# File 'lib/faye/protocol/subscription.rb', line 17 def unsubscribe cancel end |