Class: Conquer::EventSegment::Worker
- Inherits:
-
Object
- Object
- Conquer::EventSegment::Worker
- Includes:
- Celluloid, Celluloid::Notifications
- Defined in:
- lib/conquer/event_segment.rb
Instance Method Summary collapse
- #handle_event(event, *args) ⇒ Object
-
#initialize(topic, block, *subscribed_topics) ⇒ Worker
constructor
A new instance of Worker.
Constructor Details
#initialize(topic, block, *subscribed_topics) ⇒ Worker
Returns a new instance of Worker.
11 12 13 14 15 |
# File 'lib/conquer/event_segment.rb', line 11 def initialize(topic, block, *subscribed_topics) @topic = topic @block = wrapped_proc(block) subscribed_topics.each { |t| subscribe(t, :handle_event) } end |
Instance Method Details
#handle_event(event, *args) ⇒ Object
17 18 19 |
# File 'lib/conquer/event_segment.rb', line 17 def handle_event(event, *args) publish(@topic, @block.call(event, *args).to_s.chomp) end |