Module: SupplyDrop::Util

Defined in:
lib/supply_drop/util.rb

Constant Summary collapse

DEFAULT_THREAD_POOL_SIZE =
10

Class Method Summary collapse

Class Method Details

.optionally_async(collection, async) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/supply_drop/util.rb', line 13

def self.optionally_async(collection, async)
  if async
    async_collection = collection.clone
    async_collection.extend SupplyDrop::AsyncEnumerable
    async_collection
  else
    collection
  end
end

.thread_pool_sizeObject



5
6
7
# File 'lib/supply_drop/util.rb', line 5

def self.thread_pool_size
  @thread_pool_size ||= DEFAULT_THREAD_POOL_SIZE
end

.thread_pool_size=(size) ⇒ Object



9
10
11
# File 'lib/supply_drop/util.rb', line 9

def self.thread_pool_size=(size)
  @thread_pool_size = size
end