-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yabeda v0.13.0 breaks Ruby 2.7 #40
Comments
Ruby 2.x keyword argument handling for methods with arguments with default values was an absolute mess. See #26 (comment) I shouldn't release this as is (I just didn't notice CI failure for 2.7 due to flaky specs in previous commits). Probably I'm going to yank this release and re-release it with Ruby 2.x support dropped and minimum required Ruby bumped to 3.0 |
Doesn't the |
Something like this would work (but will be ugly as hell): # def increment(tags = {}, by: 1)
def increment(*args)
tags, by = parse_args(*args)
# …
end
def parse_args(*args)
case args.size
when 0 # increment()
[{}, 1]
when 1 # increment(by: 5) or increment(tags)
if args[0].key?(:by)
[{}, args.fetch(:by)]
else
[args[0], 1]
end
when 2 # increment(tags, by: 5)
[args[0], args[1].fetch(:by, 1)]
else
raise ArgumentError, "wrong number of arguments (given #{args.size}, expected 0..2)"
end
end |
Fix has been released in 0.13.1 |
Hey! This feature has broke Ruby 2.7
The text was updated successfully, but these errors were encountered: