Object
# File lib/redis/subscribe.rb, line 7 def call(command) @client.process([command]) end
# File lib/redis/subscribe.rb, line 15 def psubscribe(*channels, &block) subscription("psubscribe", "punsubscribe", channels, block) end
# File lib/redis/subscribe.rb, line 23 def punsubscribe(*channels) call([:punsubscribe, *channels]) end
# File lib/redis/subscribe.rb, line 29 def subscription(start, stop, channels, block) sub = Subscription.new(&block) unsubscribed = false begin @client.call_loop([start, *channels]) do |line| type, *rest = line sub.callbacks[type].call(*rest) unsubscribed = type == stop && rest.last == 0 break if unsubscribed end ensure # No need to unsubscribe here. The real client closes the connection # whenever an exception is raised (see #ensure_connected). end end
Generated with the Darkfish Rdoc Generator 2.