Class: Redis::Subscription

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Subscription

Returns a new instance of Subscription.

Yields:

  • (_self)

Yield Parameters:



85
86
87
88
# File 'lib/redis/subscribe.rb', line 85

def initialize
  @callbacks = {}
  yield(self)
end

Instance Attribute Details

#callbacksObject (readonly)

Returns the value of attribute callbacks.



83
84
85
# File 'lib/redis/subscribe.rb', line 83

def callbacks
  @callbacks
end

Instance Method Details

#message(&block) ⇒ Object



98
99
100
# File 'lib/redis/subscribe.rb', line 98

def message(&block)
  @callbacks["message"] = block
end

#pmessage(&block) ⇒ Object



110
111
112
# File 'lib/redis/subscribe.rb', line 110

def pmessage(&block)
  @callbacks["pmessage"] = block
end

#psubscribe(&block) ⇒ Object



102
103
104
# File 'lib/redis/subscribe.rb', line 102

def psubscribe(&block)
  @callbacks["psubscribe"] = block
end

#punsubscribe(&block) ⇒ Object



106
107
108
# File 'lib/redis/subscribe.rb', line 106

def punsubscribe(&block)
  @callbacks["punsubscribe"] = block
end

#smessage(&block) ⇒ Object



122
123
124
# File 'lib/redis/subscribe.rb', line 122

def smessage(&block)
  @callbacks["smessage"] = block
end

#ssubscribe(&block) ⇒ Object



114
115
116
# File 'lib/redis/subscribe.rb', line 114

def ssubscribe(&block)
  @callbacks["ssubscribe"] = block
end

#subscribe(&block) ⇒ Object



90
91
92
# File 'lib/redis/subscribe.rb', line 90

def subscribe(&block)
  @callbacks["subscribe"] = block
end

#sunsubscribe(&block) ⇒ Object



118
119
120
# File 'lib/redis/subscribe.rb', line 118

def sunsubscribe(&block)
  @callbacks["sunsubscribe"] = block
end

#unsubscribe(&block) ⇒ Object



94
95
96
# File 'lib/redis/subscribe.rb', line 94

def unsubscribe(&block)
  @callbacks["unsubscribe"] = block
end