Class: Redis::SubscribedClient

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ SubscribedClient

Returns a new instance of SubscribedClient.



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

def initialize(client)
  @client = client
end

Instance Method Details

#call(command) ⇒ Object



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

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

#psubscribe(*channels, &block) ⇒ Object



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

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

#psubscribe_with_timeout(timeout, *channels, &block) ⇒ Object



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

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

#punsubscribe(*channels) ⇒ Object



31
32
33
# File 'lib/redis/subscribe.rb', line 31

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

#subscribe(*channels, &block) ⇒ Object



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

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

#subscribe_with_timeout(timeout, *channels, &block) ⇒ Object



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

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

#unsubscribe(*channels) ⇒ Object



27
28
29
# File 'lib/redis/subscribe.rb', line 27

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