Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Pretty big/breaking change in the new Ruby 2.0.0 patch level (p0 => p195).
def keyword_fun arg = nil, **options
[arg, options]
end
keyword_fun hello: 'world', 'goodnight' => 'moon'
# Ruby 2.0.0p0
# => [nil, {:hello=>"world", "goodnight"=>"moon"}]
# Ruby 2.0.0p195
# => [{"goodnight"=>"moon"}, {:hello=>"world"}]
@rantler

This comment has been minimized.

Copy link

commented May 16, 2013

nasty bug. But, tbh I would never write a hash that mixed old and new styles like that.

@stephencelis

This comment has been minimized.

Copy link
Owner Author

commented May 17, 2013

Yeah, it's just more surprising than anything else. You can no longer pass a HashWithIndifferentAccess as keyword arguments, or use **options to extract the last hash from *args (you have to use Array#pop or Array#extract_options!, as before).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.