Skip to content

Instantly share code, notes, and snippets.

@byroot
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save byroot/9495455 to your computer and use it in GitHub Desktop.
Save byroot/9495455 to your computer and use it in GitHub Desktop.
class Foo
def bar(*args)
attribute(:bar, *args)
end
def attribute(name)
puts name
end
end
foo = Foo.new
begin
foo.bar(100)
rescue => e
puts e.class.name
end
foo.bar # legit
5.times do
foo.bar(100)
end
puts 'No errors??? WTF???'
@byroot
Copy link
Author

byroot commented Mar 11, 2014

ruby >= 2.0 output:

ArgumentError
bar
bar
bar
bar
bar
bar
No errors??? WTF???

ruby 1.8.7 (anything < 2.0) output:

ArgumentError
bar
(eval):3:in `attribute': wrong number of arguments (2 for 1) (ArgumentError)
    from (eval):3:in `bar'
    from foo.rb:28
    from foo.rb:27:in `times'
    from foo.rb:27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment