Module: Pubnub::SubscribeEvent::Removing

Included in:
Pubnub::SubscribeEvent
Defined in:
lib/pubnub/subscribe_event/removing.rb

Overview

Holds methods connected with channels and cg removal

Instance Method Summary collapse

Instance Method Details

#remove(event = nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/pubnub/subscribe_event/removing.rb', line 20

def remove(event = nil)
  Pubnub.logger.debug('Pubnub') { "#{self.class}#remove" }
  # kill_requester

  if event
    remove_channels(event)
    remove_groups(event)
  end

  if @channel.empty? && @group.empty?
    finish
  else
    restart_heartbeat if @heart
  end
end

#remove_channels(event) ⇒ Object



13
14
15
16
17
18
# File 'lib/pubnub/subscribe_event/removing.rb', line 13

def remove_channels(event)
  event.channel.each do |channel|
    remove_channel channel
    remove_c_cb channel
  end
end

#remove_groups(event) ⇒ Object



6
7
8
9
10
11
# File 'lib/pubnub/subscribe_event/removing.rb', line 6

def remove_groups(event)
  event.group.each do |group|
    remove_group group
    remove_g_cb group
  end
end