shotgunner 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/shotgunner.rb +4 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 377273e56c678439072e88eb501c56c6d349662b92e62da37b6291615be532b0
4
- data.tar.gz: 12985133b5b55d4689ee966165e9b09094205b26710e713c38376541eb8b8d48
3
+ metadata.gz: 32f3dfa30655a6843d61bffc54e25c80c50e6fdb6965ec389f6ce1af2cb8367e
4
+ data.tar.gz: 6671f973787b736fd090eb169f3e2ac1a2a89dc373d7f64c5495bc7319459c80
5
5
  SHA512:
6
- metadata.gz: ece39ce4c736087077e5174f94c4db0bf313ab0ea3c71278abf86a728e6f12f4dc06eba612813fc3cc9f6d0cda4ce6b623fe5dfd2f1baa763c67b85544909f22
7
- data.tar.gz: c38ec26daaabec76f0c6619004b00eb8b0ef65feba693ead45033d503aaaf91580e7d0ecf7e02e43b8438585f99e560e204e1710c30c2afc845347062c66718e
6
+ metadata.gz: ae49737f4e038d2ace4a667afc69e584e24d5798722126bd1b5fd83aecb8d060e9981e985210a670284b303ab6a2f669df8f30c99ea8137345064641b66bea9f
7
+ data.tar.gz: dda54ed6fdf9d4fd9cac5248032d90664c512920d75bb68658b0f14994c77f841d36f7022e1305126dc18f0994bc2d088918e761f8fb72dd7170d11952ba4c91
data/lib/shotgunner.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shotgunner
4
- class Parallel
4
+ module Parallel
5
5
  def self.included(base)
6
6
  base.extend(ClassMethods)
7
- base.send(:set_defaults)
8
7
  base.send(:include, InstanceMethods)
9
8
  end
10
9
 
@@ -19,6 +18,7 @@ module Shotgunner
19
18
  mutex = Mutex.new
20
19
  threads = options[:threads] || 4
21
20
  tasks = options[:tasks] || []
21
+ raise ArgumentError, 'There is no tasks array defined!' if tasks.empty?
22
22
  call_results = []
23
23
  threads.times.map do
24
24
  Thread.new(tasks, call_results) do |tasks, call_results|
@@ -26,8 +26,8 @@ module Shotgunner
26
26
  call_result = yield(task)
27
27
  mutex.synchronize { call_results << call_result }
28
28
  end
29
- end.each(&:join)
30
- end
29
+ end
30
+ end.each(&:join)
31
31
  call_results
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shotgunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov
@@ -38,5 +38,5 @@ requirements: []
38
38
  rubygems_version: 3.0.8
39
39
  signing_key:
40
40
  specification_version: 4
41
- summary: shotgunner fetch external api in a shotgun way
41
+ summary: Shotgunner - helps to fetch external api in a parallel way! Fast and furious!
42
42
  test_files: []