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
- #subscribe(&block) ⇒ Object
- #unsubscribe(&block) ⇒ Object
Constructor Details
#initialize {|_self| ... } ⇒ Subscription
Returns a new instance of Subscription.
69 70 71 72 |
# File 'lib/redis/subscribe.rb', line 69 def initialize @callbacks = {} yield(self) end |
Instance Attribute Details
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
67 68 69 |
# File 'lib/redis/subscribe.rb', line 67 def callbacks @callbacks end |
Instance Method Details
#message(&block) ⇒ Object
82 83 84 |
# File 'lib/redis/subscribe.rb', line 82 def (&block) @callbacks["message"] = block end |
#pmessage(&block) ⇒ Object
94 95 96 |
# File 'lib/redis/subscribe.rb', line 94 def (&block) @callbacks["pmessage"] = block end |
#psubscribe(&block) ⇒ Object
86 87 88 |
# File 'lib/redis/subscribe.rb', line 86 def psubscribe(&block) @callbacks["psubscribe"] = block end |
#punsubscribe(&block) ⇒ Object
90 91 92 |
# File 'lib/redis/subscribe.rb', line 90 def punsubscribe(&block) @callbacks["punsubscribe"] = block end |
#subscribe(&block) ⇒ Object
74 75 76 |
# File 'lib/redis/subscribe.rb', line 74 def subscribe(&block) @callbacks["subscribe"] = block end |
#unsubscribe(&block) ⇒ Object
78 79 80 |
# File 'lib/redis/subscribe.rb', line 78 def unsubscribe(&block) @callbacks["unsubscribe"] = block end |