Class: WorkerThreadSet
- Inherits:
-
Set
- Object
- Set
- WorkerThreadSet
- Defined in:
- lib/codegrinder/worker_thread_set.rb
Overview
A set of worker threads, whose behavior is the very same
Defined Under Namespace
Classes: NullWorkerThreadSet
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(count, &block) ⇒ WorkerThreadSet
constructor
A new instance of WorkerThreadSet.
- #join ⇒ Object
Constructor Details
#initialize(count, &block) ⇒ WorkerThreadSet
Returns a new instance of WorkerThreadSet.
9 10 11 12 13 |
# File 'lib/codegrinder/worker_thread_set.rb', line 9 def initialize(count, &block) fail(RuntimError, 'Missing block') if block.nil? super() count.times { self << Thread.new(&block) } end |
Class Method Details
.null_object ⇒ Object
19 20 21 |
# File 'lib/codegrinder/worker_thread_set.rb', line 19 def self.null_object NullWorkerThreadSet.instance end |
Instance Method Details
#join ⇒ Object
15 16 17 |
# File 'lib/codegrinder/worker_thread_set.rb', line 15 def join each(&:join) end |