Module: Tresse
- Defined in:
- lib/tresse.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
'1.2.0'
Class Method Summary collapse
- .call_block(block, args) ⇒ Object
- .enqueue(batch) ⇒ Object
- .init ⇒ Object
- .max_work_thread_count ⇒ Object
- .max_work_thread_count=(i) ⇒ Object
Class Method Details
.call_block(block, args) ⇒ Object
72 73 74 75 |
# File 'lib/tresse.rb', line 72 def self.call_block(block, args) block.call(*args[0, block.arity.abs]) end |
.enqueue(batch) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/tresse.rb', line 17 def enqueue(batch) @work_queue << batch batch.group end |
.init ⇒ Object
11 12 13 14 15 |
# File 'lib/tresse.rb', line 11 def init @work_queue = Queue.new @work_threads = 8.times.collect { |i| make_work_thread } end |
.max_work_thread_count ⇒ Object
24 25 26 27 |
# File 'lib/tresse.rb', line 24 def max_work_thread_count @work_threads.size end |
.max_work_thread_count=(i) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/tresse.rb', line 29 def max_work_thread_count=(i) i0 = @work_threads.size @work_threads << make_work_thread while @work_threads.size < i @work_threads.pop while @work_threads.size > i i end |