Class: Pubnub::Subscription
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#channel ⇒ Object
Returns the value of attribute channel.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #fire_callback_for(envelope) ⇒ Object
- #get_channel ⇒ 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/pubnub/subscription.rb', line 5 def initialize() @channel = [:channel] @callback = [:callback] end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
3 4 5 |
# File 'lib/pubnub/subscription.rb', line 3 def callback @callback end |
#channel ⇒ Object
Returns the value of attribute channel.
3 4 5 |
# File 'lib/pubnub/subscription.rb', line 3 def channel @channel end |
Instance Method Details
#==(other) ⇒ Object
16 17 18 |
# File 'lib/pubnub/subscription.rb', line 16 def ==(other) (@channel == other.get_channel && @callback == other.callback && @error_callback == other.error_callback) end |
#fire_callback_for(envelope) ⇒ Object
10 11 12 13 14 |
# File 'lib/pubnub/subscription.rb', line 10 def fire_callback_for(envelope) $log.debug "CALLING SUBSCRIPTION CALLBACK FOR CHANNEL #{@channel}" if envelope.channel == @channel @callback.call envelope if envelope.channel == @channel $log.debug "AFTER CALLING SUBSCRIPTION CALLBACK FOR CHANNEL #{@channel}" end |
#get_channel ⇒ Object
20 21 22 |
# File 'lib/pubnub/subscription.rb', line 20 def get_channel @channel end |