abstractivator 0.17.0 → 0.18.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b63dfde1120e13e9caa680503d426bc9920cf71a
|
4
|
+
data.tar.gz: 9067bc5629954a5e2a693b91095d759ce3131602
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbc09f02c2159b81340c2ab7b0c55fa5f508595f753297534f23dff33e974ff33449889abfa3014f973cd0cc47413e1a2d85dfd7fa89392d25e4bf7027ec6c13
|
7
|
+
data.tar.gz: ad28b8056c20f5f3b31a173044fb948aeacb4b5ff5c2e8ed41e7b23270c627c6ab96574207731b351496af7ec45f54832e535329549569f0cdea4b0e7a313f48
|
@@ -217,4 +217,22 @@ describe Enumerable do
|
|
217
217
|
expect(result).to eql [g, a, b]
|
218
218
|
end
|
219
219
|
end
|
220
|
+
|
221
|
+
describe '#fold_right' do
|
222
|
+
it 'folds right' do
|
223
|
+
op = proc { |char, acc| "#{char}(#{acc})" }
|
224
|
+
expect(%w[].fold_right('z', &op)).to eql 'z'
|
225
|
+
expect(%w[a].fold_right('z', &op)).to eql 'a(z)'
|
226
|
+
expect(%w[a b].fold_right('z', &op)).to eql 'a(b(z))'
|
227
|
+
expect(%w[a b c].fold_right('z', &op)).to eql 'a(b(c(z)))'
|
228
|
+
end
|
229
|
+
it 'allows the same argument variations as Enumerable#reduce' do
|
230
|
+
expect([].fold_right(:+)).to be_nil
|
231
|
+
expect([].fold_right(0, :+)).to eql 0
|
232
|
+
expect([1].fold_right(:+)).to eql 1
|
233
|
+
expect([1].fold_right(0, :+)).to eql 1
|
234
|
+
expect([1,2].fold_right(:+)).to eql 3
|
235
|
+
expect([1,2].fold_right(0, :+)).to eql 3
|
236
|
+
end
|
237
|
+
end
|
220
238
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abstractivator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Winton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|