Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created April 9, 2014 06:53
Show Gist options
  • Save ukstudio/10233441 to your computer and use it in GitHub Desktop.
Save ukstudio/10233441 to your computer and use it in GitHub Desktop.
keyword args
def foo
:foo
end
def bar(foo = 1)
p foo #=> 1(2.1.1, 2.2.0)
end
def hoge(foo = foo)
p foo #=> :foo(2.1.1), nil(2.2.0)
end
def fuga(foo = foo())
p foo #=> :foo(2.1.1, 2.2.0)
end
bar
hoge
fuga
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment