Skip to content

Instantly share code, notes, and snippets.

@brixen
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brixen/fbd4a1cebb23ef6b4d85 to your computer and use it in GitHub Desktop.
Save brixen/fbd4a1cebb23ef6b4d85 to your computer and use it in GitHub Desktop.
Keyword rest argument processing is inconsistent
$ ruby -v keyword_gotcha.rb
ruby 2.2.0dev (2014-06-05 trunk 46353) [x86_64-darwin13]
1
{:b=>2}
{:b=>2}
1
{}
{:gotcha=>1}
def m(a: 1, **kw)
p a, kw
kw[:gotcha] = 1
end
h = {b: 2}
m h
p h
h = {}
m h
p h
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment