Last active
August 29, 2015 14:03
-
-
Save elarkin/8d7ea1968a77527b40c4 to your computer and use it in GitHub Desktop.
Ruby off the deep end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo | |
def method_missing(*args) | |
puts("Called with: #{args.inspect}") | |
4 | |
end | |
end | |
class Bar < Foo | |
def respond_to?(*args) | |
super | |
end | |
end | |
class Baz < Bar | |
end | |
[Foo.new].flatten rescue puts "Foo throws an exception!" | |
[Bar.new].flatten rescue puts "Bar throws an exception!" | |
[Baz.new].flatten rescue puts "Baz throws an exception!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment