Class: Cnf::Watcher
- Inherits:
-
Object
- Object
- Cnf::Watcher
- Defined in:
- lib/cnf/watcher.rb
Instance Attribute Summary collapse
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
- #channel ⇒ Object
-
#initialize ⇒ Watcher
constructor
A new instance of Watcher.
- #on_message_received(_) ⇒ Object
Constructor Details
#initialize ⇒ Watcher
Returns a new instance of Watcher.
12 13 14 |
# File 'lib/cnf/watcher.rb', line 12 def initialize @redis = Redis.new(url: ENV["REDIS_PUBSUB_URL"]) end |
Instance Attribute Details
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
10 11 12 |
# File 'lib/cnf/watcher.rb', line 10 def redis @redis end |
Class Method Details
.call ⇒ Object
6 7 8 |
# File 'lib/cnf/watcher.rb', line 6 def self.call new().call end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/cnf/watcher.rb', line 20 def call keep_connecting(redis) do redis.subscribe(channel) do |on| on. do |_, msg| (msg) end end end end |
#channel ⇒ Object
16 17 18 |
# File 'lib/cnf/watcher.rb', line 16 def channel "console" end |
#on_message_received(_) ⇒ Object
30 31 32 |
# File 'lib/cnf/watcher.rb', line 30 def (_) raise NotImplementedError.new end |