Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2013 23:12
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]
keyword_fun hello: 'world', 'goodnight' => 'moon'
# Ruby 2.0.0p0
# => [nil, {:hello=>"world", "goodnight"=>"moon"}]
# Ruby 2.0.0p195
# => [{"goodnight"=>"moon"}, {:hello=>"world"}]
Copy link

rantler commented May 16, 2013

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

Copy link

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