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.



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

def initialize(client)
  @client = client
end

Instance Method Details

#call(command) ⇒ Object



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

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

#psubscribe(*channels, &block) ⇒ Object



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

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

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



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

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

#punsubscribe(*channels) ⇒ Object



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

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

#subscribe(*channels, &block) ⇒ Object



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

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

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



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

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

#unsubscribe(*channels) ⇒ Object



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

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