Skip to content

Instantly share code, notes, and snippets.

@pjb3
Created January 14, 2014 16:07
Show Gist options
  • Save pjb3/8420773 to your computer and use it in GitHub Desktop.
Save pjb3/8420773 to your computer and use it in GitHub Desktop.
Looking when default arguments are resolved in Ruby 2.0
def foo(x: wtf)
end
puts "wtf did not get called when the method was defined"
foo x: 1
puts "wtf did not get called when we passed a value for x"
begin
foo
rescue => ex
puts "tried to call wtf, so we got #{ex.class} #{ex.message}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment