abstractivator 0.14.0 → 0.15.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 +4 -4
- data/lib/abstractivator/proc_ext.rb +1 -1
- data/lib/abstractivator/version.rb +1 -1
- data/spec/lib/abstractivator/proc_ext_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54f3b2d12bb7c97e29e93c119a4765d096bd67d8
|
4
|
+
data.tar.gz: 0b51547e1f0d6dd51d166094aa1fc49e86f3d9be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ef0efeda3115b72e4e5c68050f01ed5da7b28771be78177aa8069c27eb0151583e6fc1d59356165797a7150a7dd98fd95eb8b768a27df1e9a02669c11ecad50
|
7
|
+
data.tar.gz: 2cd2fd65d5d5da79a16bcace335f1ea136a43bea38e69a5a51656486c0a3663536b5a2db8000d766fed4336b1d97974024fac19fbd410c109080a7b1850d1766
|
@@ -97,7 +97,7 @@ class Proc
|
|
97
97
|
info.accepts_arg_splat = params.any? { |p| p.first == :rest }
|
98
98
|
accepts_kw_splat = params.any? { |p| p.first == :keyrest }
|
99
99
|
has_kw_args = params.any? { |(type, name)| (type == :key || type == :keyreq) && !name.nil? }
|
100
|
-
info.requires_kw_customization = has_kw_args && !accepts_kw_splat
|
100
|
+
info.requires_kw_customization = (has_kw_args || kws.any?) && !accepts_kw_splat
|
101
101
|
if info.requires_kw_customization
|
102
102
|
opt_key_names = info.params.select { |(type, name)| type == :key && !name.nil? }.map(&:value)
|
103
103
|
req_key_names = info.params.select { |(type, name)| type == :keyreq && !name.nil? }.map(&:value)
|
@@ -112,6 +112,11 @@ context 'in the world of functional programming' do
|
|
112
112
|
result = do_call(p, [11, 22], {d: 44, z: 5}) { 42 }
|
113
113
|
expect(result).to eql [11, 22, 3, 44, 5, nil, 42]
|
114
114
|
end
|
115
|
+
it 'works when the proc accepts no keyword arguments' do
|
116
|
+
p = ->(a) {[a]}
|
117
|
+
result = do_call(p, [42], {a: 99})
|
118
|
+
expect(result).to eql [42]
|
119
|
+
end
|
115
120
|
it 'works with a mixture of splat types' do
|
116
121
|
p = ->(*args, **kws, &block){[args, kws, block.call]}
|
117
122
|
result = do_call(p, [1, 2], {c: 3, d: 4}) { 42 }
|
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.15.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-04-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|