Skip to content

Instantly share code, notes, and snippets.

@elarkin
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elarkin/8d7ea1968a77527b40c4 to your computer and use it in GitHub Desktop.
Save elarkin/8d7ea1968a77527b40c4 to your computer and use it in GitHub Desktop.
Ruby off the deep end
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