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.



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

def initialize(client)
  @client = client
end

Instance Method Details

#call(command) ⇒ Object



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

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

#psubscribe(*channels, &block) ⇒ Object



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

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

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



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

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

#punsubscribe(*channels) ⇒ Object



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

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

#subscribe(*channels, &block) ⇒ Object



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

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

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



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

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

#unsubscribe(*channels) ⇒ Object



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

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