Module: Promiscuous::Worker
- Defined in:
- lib/promiscuous/worker.rb
Class Method Summary collapse
Class Method Details
.replicate(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/promiscuous/worker.rb', line 5 def self.replicate(={}) [:action] ||= [:publish, :subscribe] actions = [[:action]].flatten self.workers << Promiscuous::Publisher::Worker.new() if :publish.in? actions self.workers << Promiscuous::Subscriber::Worker.new() if :subscribe.in? actions self.workers.each { |w| w.replicate } end |
.stop ⇒ Object
14 15 16 17 |
# File 'lib/promiscuous/worker.rb', line 14 def self.stop self.workers.each { |w| w.stop = true } self.workers.clear end |