dry-initializer
dry-initializer copied to clipboard
Fix arity check for defaults
This PR fixes false negatives for default values wrapped into lambdas and procs.
Source of the problem:
la = ->(a,b,*c) {}
pr = proc {|a,b,*c|}
lambda.arity #=> -3
proc.arity #=> -3
lambda.method(:call).arity #=> -1
proc.method(:call).arity #=> -1
I left it possible to use defaults with one (and only one) splat operator.
Hey @solnic It looks like your review is necessary even to merge Svyatoslav's PR into my branch (I'd like to recheck and fix rubocop issues before opening a PR to main branch) Could you look at it, please?