Warning due to splat operator with ruby 2.7
Juanmcuello opened this issue · comments
When using validate
with keywords arguments, ruby 2.7 shows a warning:
def validate(available_articles:)
# ..
end
scrivener/lib/scrivener/validations.rb:72: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
This is due to valid?
method definition using the splat operator when forwarding arguments to validate
:
def valid?(*args)
# ...
validate(*args)
# ...
end
This could be fixed using the double splat, as suggested by the warning message, but that wouldn't allow the use of positional parameters in validate
definition.
I think that adding an extra parameter to the valid?
definition should work for all cases:
def valid?(*args, **kargs)
# ..
validate(*args, **kargs)
# ..
end
Of course, this would break compatibility with ruby 1.9 (not sure about ruby 2.0), but I don't think that version is intended to be supported.
It that makes sense, I could crate a PR with the proposal.
It makes perfect sense! Send the pull request and we can release a new version.
Thanks!