abstractivator 0.14.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa5f0441439d94fb15db90acbcc41c99f378d5fd
4
- data.tar.gz: 66885acd1df0f4322a21dcbedf41da2028416604
3
+ metadata.gz: 54f3b2d12bb7c97e29e93c119a4765d096bd67d8
4
+ data.tar.gz: 0b51547e1f0d6dd51d166094aa1fc49e86f3d9be
5
5
  SHA512:
6
- metadata.gz: db0062035f743c6a51c716ff3b52db47ed96f16b96333d858f0e698d1d864153cabcff4f5bad10ab4f6ad75101ef0742a4199e57f2cfef37328e116b16596d8f
7
- data.tar.gz: e120d0ba2180cb4dda23e6d9a9a57043b277a2cab2fd8c720a7c96b6c8e73f86ac1e4ec834b2f4db5477339c5309ff479d36c2599f14e50dfce939a5d3daf5d7
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)
@@ -1,3 +1,3 @@
1
1
  module Abstractivator
2
- VERSION = '0.14.0'
2
+ VERSION = '0.15.0'
3
3
  end
@@ -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.14.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-12 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler