Class: QQQ::Developer
- Inherits:
-
Object
- Object
- QQQ::Developer
- Defined in:
- lib/qqq.rb
Overview
Developer log channels
Instance Method Summary collapse
-
#initialize ⇒ Developer
constructor
A new instance of Developer.
- #mark ⇒ Object
- #publish(message) ⇒ Object
- #subscribe(&block) ⇒ Object
Constructor Details
#initialize ⇒ Developer
Returns a new instance of Developer.
38 39 40 |
# File 'lib/qqq.rb', line 38 def initialize @mark_counter = 0 end |
Instance Method Details
#mark ⇒ Object
42 43 44 45 |
# File 'lib/qqq.rb', line 42 def mark @mark_counter += 1 publish("MARK: --MARK-- (#{@mark_counter})") end |
#publish(message) ⇒ Object
47 48 49 50 |
# File 'lib/qqq.rb', line 47 def publish() event = Event.() redis.publish(Keys::EVENT_CHANNEL_KEY, event.to_json) end |
#subscribe(&block) ⇒ Object
52 53 54 55 56 57 58 59 |
# File 'lib/qqq.rb', line 52 def subscribe &block redis.subscribe Keys::EVENT_CHANNEL_KEY do |on| on. do |channel, event_json_string| event = Event.from_json_string(event_json_string) block.call(event) end end end |