Class: ActorSystem::Concurrent::Processor
- Defined in:
- lib/actor_system/concurrent/processor.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Processor
constructor
A new instance of Processor.
Constructor Details
#initialize(name) ⇒ Processor
Returns a new instance of Processor.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/actor_system/concurrent/processor.rb', line 8 def initialize(name) thread = Thread.new do loop do payload = Magique.backend.pop worker_class = payload[:worker] worker_class.new.perform(*payload[:args]) end end thread.name = name end |
Class Method Details
.start(concurrency = 1) ⇒ Object
4 5 6 |
# File 'lib/actor_system/concurrent/processor.rb', line 4 def self.start(concurrency = 1) concurrency.times { |n| new("Processor #{n}") } end |