backports 1.6.0 → 1.6.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.
Files changed (3) hide show
  1. data/VERSION.yml +1 -1
  2. data/lib/backports/array.rb +5 -6
  3. metadata +1 -1
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 6
4
- :patch: 0
4
+ :patch: 1
@@ -105,13 +105,12 @@ class Array
105
105
  end
106
106
 
107
107
  def product(*arg)
108
- arrays = [self, *arg].reverse
109
- first_enum = Enumerator.new{|yielder| yielder.yield [] }
110
- arrays.inject(first_enum) do |enum, array|
108
+ trivial_enum = Enumerator.new{|yielder| yielder.yield [] }
109
+ [self, *arg].inject(trivial_enum) do |enum, array|
111
110
  Enumerator.new do |yielder|
112
- array.each do |obj|
113
- enum.each do |partial_product|
114
- yielder.yield [obj] + partial_product
111
+ enum.each do |partial_product|
112
+ array.each do |obj|
113
+ yielder.yield partial_product + [obj]
115
114
  end
116
115
  end
117
116
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backports
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Marc-Andr\xC3\xA9 Lafortune"