class Pubnub::Subscription

Attributes

callback[RW]
channel[RW]

Public Class Methods

new(options) click to toggle source
# File lib/pubnub/subscription.rb, line 5
def initialize(options)
  @channel = options[:channel]
  @callback = options[:callback]
end

Public Instance Methods

==(other) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/pubnub/subscription.rb, line 20
def get_channel
  @channel
end