aboutsummaryrefslogtreecommitdiff
path: root/vendor/supply_drop/lib/supply_drop/util.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-10-23 03:50:52 -0700
committerelijah <elijah@riseup.net>2012-10-23 03:50:52 -0700
commitd385da49ef6c17c64cf8be66002f5744c1ee38f7 (patch)
tree6e19772d6adf2b302e73dbd9229eb3618d19bab0 /vendor/supply_drop/lib/supply_drop/util.rb
parent3a27d87e6a28e4b58842ca4cb7a1ddc4e6637b36 (diff)
downloadleap_cli-d385da49ef6c17c64cf8be66002f5744c1ee38f7.tar.gz
leap_cli-d385da49ef6c17c64cf8be66002f5744c1ee38f7.tar.bz2
patched supply_drop gem and vendored it
Diffstat (limited to 'vendor/supply_drop/lib/supply_drop/util.rb')
-rw-r--r--vendor/supply_drop/lib/supply_drop/util.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/vendor/supply_drop/lib/supply_drop/util.rb b/vendor/supply_drop/lib/supply_drop/util.rb
new file mode 100644
index 0000000..5f4f9f4
--- /dev/null
+++ b/vendor/supply_drop/lib/supply_drop/util.rb
@@ -0,0 +1,23 @@
+module SupplyDrop
+ module Util
+ DEFAULT_THREAD_POOL_SIZE = 10
+
+ def self.thread_pool_size
+ @thread_pool_size ||= DEFAULT_THREAD_POOL_SIZE
+ end
+
+ def self.thread_pool_size=(size)
+ @thread_pool_size = size
+ end
+
+ def self.optionally_async(collection, async)
+ if async
+ async_collection = collection.clone
+ async_collection.extend SupplyDrop::AsyncEnumerable
+ async_collection
+ else
+ collection
+ end
+ end
+ end
+end