Class: Redis2::SubscribedClient

Inherits:
Object
  • Object
show all
Defined in:
lib/redis2/subscribe.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SubscribedClient

Returns a new instance of SubscribedClient.



3
4
5
# File 'lib/redis2/subscribe.rb', line 3

def initialize(client)
  @client = client
end

Instance Method Details

#call(command) ⇒ Object



7
8
9
# File 'lib/redis2/subscribe.rb', line 7

def call(command)
  @client.process([command])
end

#psubscribe(*channels, &block) ⇒ Object



15
16
17
# File 'lib/redis2/subscribe.rb', line 15

def psubscribe(*channels, &block)
  subscription("psubscribe", "punsubscribe", channels, block)
end

#punsubscribe(*channels) ⇒ Object



23
24
25
# File 'lib/redis2/subscribe.rb', line 23

def punsubscribe(*channels)
  call([:punsubscribe, *channels])
end

#subscribe(*channels, &block) ⇒ Object



11
12
13
# File 'lib/redis2/subscribe.rb', line 11

def subscribe(*channels, &block)
  subscription("subscribe", "unsubscribe", channels, block)
end

#unsubscribe(*channels) ⇒ Object



19
20
21
# File 'lib/redis2/subscribe.rb', line 19

def unsubscribe(*channels)
  call([:unsubscribe, *channels])
end