batches 1.0.0 → 1.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b54dd7abe1e73c35f81e4224a0863306b3c09105
4
- data.tar.gz: f9378cbca7847d3c463671d1b21a0669160844d5
3
+ metadata.gz: d6ca29db1c0da3a1ff3d969a9eeb91f5cb0f3e2b
4
+ data.tar.gz: e537430c0aec395cd2f1344c0b4a1da141c3e7ef
5
5
  SHA512:
6
- metadata.gz: d5e7cf8e55a43cf8a330852a5e65ee044e99b715b1fd0bb8f9e265f48e321278d96eec03991cf567425ea27272928a42ef86bc91157d58a5a613a830564d6d12
7
- data.tar.gz: f7954f9f0fb7f8d07ba6aabefb5dfda4adf5578055cd1ecae479ba29f2a02ea3094dd8dedd9236cc4c1d3f230a6673cd234e9c2d7f4b3a7ce851809181170e61
6
+ metadata.gz: 90ccb38764f7bd5d229b02193bd688ffca83eceb1c25aca03a05fb300e04e3540e2c3939e6bcc5cffb1a6f48272e2304c0c1a7aee019cbf1309d588befe01503
7
+ data.tar.gz: e73e246343944382b5ae5a4f575ec3b02faa175002df8d53cd16559c17df1c80e49eb1dac443a93d24016f18b62ffcf0cbd71b37ac74a22945c8d4caea1d26cb
@@ -1,6 +1,8 @@
1
1
  require "batches/version"
2
2
 
3
3
  class Batches
4
+ class NoBlockError < ArgumentError; end
5
+
4
6
  def self.do(cocurrence, entities, &block)
5
7
  raise NoBlockError, "No block given" unless block
6
8
  entities.each_slice(cocurrence) do |group|
@@ -1,3 +1,3 @@
1
1
  class Batches
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -0,0 +1,9 @@
1
+ require 'batches'
2
+
3
+ describe "Batches.do" do
4
+ it "should do 20 times in multiple threads" do
5
+ Batches.do(20, (1..200).to_a) do |i|
6
+ print "#{i} "
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batches
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - binz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-22 00:00:00.000000000 Z
11
+ date: 2014-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,6 +53,7 @@ files:
53
53
  - batches.gemspec
54
54
  - lib/batches.rb
55
55
  - lib/batches/version.rb
56
+ - spec/batches_spec.rb
56
57
  homepage: https://github.com/Slacken/batches
57
58
  licenses:
58
59
  - MIT
@@ -77,4 +78,5 @@ rubygems_version: 2.2.2
77
78
  signing_key:
78
79
  specification_version: 4
79
80
  summary: A simple wrapper of <cocurrence> threads to process <entities>
80
- test_files: []
81
+ test_files:
82
+ - spec/batches_spec.rb