Class: Redis::Subscription
- Inherits:
-
Object
- Object
- Redis::Subscription
- Defined in:
- lib/redis/subscribe.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
Instance Method Summary collapse
-
#initialize {|_self| ... } ⇒ Subscription
constructor
A new instance of Subscription.
- #message(&block) ⇒ Object
- #pmessage(&block) ⇒ Object
- #psubscribe(&block) ⇒ Object
- #punsubscribe(&block) ⇒ Object
- #smessage(&block) ⇒ Object
- #ssubscribe(&block) ⇒ Object
- #subscribe(&block) ⇒ Object
- #sunsubscribe(&block) ⇒ Object
- #unsubscribe(&block) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Subscription
Returns a new instance of Subscription.
85 86 87 88 |
# File 'lib/redis/subscribe.rb', line 85 def initialize @callbacks = {} yield(self) end |
Instance Attribute Details
#callbacks ⇒ Object (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 (&block) @callbacks["message"] = block end |
#pmessage(&block) ⇒ Object
110 111 112 |
# File 'lib/redis/subscribe.rb', line 110 def (&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 (&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 |