Skip to content

Instantly share code, notes, and snippets.

@iffyuva
Last active August 29, 2015 14:06
Show Gist options
  • Save iffyuva/bd58a4f6fe54ea837bfb to your computer and use it in GitHub Desktop.
Save iffyuva/bd58a4f6fe54ea837bfb to your computer and use it in GitHub Desktop.
joys of using same name for arg
class DefArg
def calc(str, val=val)
p val
end
def val
10
end
end
# ruby-2.2.0-preview1 => nil
# ruby-2.1.3 => 10
DefArg.new.calc("hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment