hyper_iterator 0.3.0 → 0.3.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: 55ad0f990d6b8995564bb008dfab3d7b31466571
4
- data.tar.gz: a1d40fae14f08758adc32ed5feb422d3e057ce61
3
+ metadata.gz: 3742ad06c0d10f57af4080becde3800e545981b9
4
+ data.tar.gz: 53a02e9053ed8dba9b1555c8ad4c5b9029e1ebeb
5
5
  SHA512:
6
- metadata.gz: 21983520dc57eff8a897387e2ec5d10f4d3c717c3ecf32b747050f5bf28a56eda9c5479c7bbd6723a6205b961f4f93d0e018f4edeed31337f08a70827072300e
7
- data.tar.gz: c8a76fb37c41b0ba6738f6c94d9bfc4df68ee48379f28cca2caddbe3a67e742711e34a5060ed47acc989b87e4123e5d793d98c319dd801ad606863103431bdad
6
+ metadata.gz: 63e39b455f06fda5a51eaf3ff80ad5eff903b457f8f513550a4f343dc8f36936bc90bba270b3cadf67c9106396955bb4d8ddb2f537a05021ed39417d651130ea
7
+ data.tar.gz: 5205e90cd34744e8f3d8d214e5ec47566fa8acc09b99ba119ea28471dd7cc57f7a16333b6f864fc3bd0ff757662e9ce4cd2a11eca149111e05912c3a1ead978e
data/README.md CHANGED
@@ -23,6 +23,12 @@ Add this line to your application's Gemfile:
23
23
  gem 'hyper_iterator'
24
24
  ```
25
25
 
26
+ Or use it with Rails
27
+
28
+ ```ruby
29
+ gem 'hyper_iterator-rails'
30
+ ```
31
+
26
32
  And then execute:
27
33
 
28
34
  $ bundle
@@ -169,8 +175,6 @@ you can get a lot more iterations!
169
175
 
170
176
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
171
177
 
172
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
173
-
174
178
  ## Contributing
175
179
 
176
180
  Bug reports and pull requests are welcome on GitHub at https://github.com/edmundleex/hyper_iterator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
data/UPDATE.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### 3/23/17
2
+
3
+ - Adding `Hash#each!` See the branch each-bang-hash
4
+ - It seems to be significantly slower than the native `each`. hmmm why?
5
+
6
+ ### 3/18/17
7
+
8
+ - Created [hyper_iterator-rails](https://github.com/EdmundLeex/hyper_iterator-rails) as
9
+ the adapter to Rails, since ActiveRecord implements its own `each` method
10
+ - Added `HyperIterator.each!(array)` as a backup method. `each` is a widely implemented
11
+ method in many gems (e.g. the one we need to deal with is the pg gem). Because of that
12
+ adding this method that takes an array as argument can be more versatile without monkey
13
+ patching for each individual library.
14
+
1
15
  ### 3/16/17
2
16
 
3
17
  - Tweak the two benchmark file and made it work
@@ -8,9 +8,11 @@ module HyperIterator
8
8
  :each!
9
9
  ].freeze
10
10
 
11
- def self.each!(arr)
12
- arr.each! { |el| yield el }
11
+ def self.each!(iterable)
12
+ iterable.each! { |el| yield el }
13
13
  end
14
14
  end
15
15
 
16
- Array.include HyperIterator
16
+ Array.include HyperIterator::EachBang
17
+ Hash.include HyperIterator::EachBang
18
+ Array.include HyperIterator
@@ -1,3 +1,3 @@
1
1
  module HyperIterator
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -1,8 +1,10 @@
1
1
  module HyperIterator
2
- def each!
3
- while count > 0
4
- yield shift
2
+ module EachBang
3
+ def each!
4
+ while count > 0
5
+ yield shift
6
+ end
7
+ nil
5
8
  end
6
- nil
7
9
  end
8
10
  end
@@ -1,5 +1,9 @@
1
1
  module HyperIterator
2
2
  def each_slice!(slice_size)
3
+ if slice_size.nil? || !slice_size.is_a?(Integer) || slice_size <= 0
4
+ raise ArgumentError, "invalid slice size"
5
+ end
6
+
3
7
  i = 0
4
8
 
5
9
  while count > 0
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hyper_iterator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edmund Li
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-18 00:00:00.000000000 Z
11
+ date: 2017-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler