Actions
Bug #13717
closedCalling lambda with keyword arguments inconsistent behavior
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-darwin16]
Description
Context: I am running a callback hook that can have multiple arguments (or none) and multiple keywords (or none).
The idea is to run this and just pass on the params:
hook.call(*args, **kw_args)
But I've encountered an issue which is an inconsistency at the same time:
hook = lambda { |a|
}
hook.call(:a, **{}) # works
kws = {};
hook.call(:a, **kws) # wrong number of arguments (2 for 1)
I would expect the params to just be passed if there are any, or none passed at all, if the object supplied is empty.
Actions
Like0
Like0Like0