Skip to content

Instantly share code, notes, and snippets.

@slawosz
Created January 4, 2011 10:28
Show Gist options
  • Save slawosz/764622 to your computer and use it in GitHub Desktop.
Save slawosz/764622 to your computer and use it in GitHub Desktop.
Chcecking hierarchy in ruby
module Foo
def foo
begin
super
p 'foo!'
rescue
p 'foo'
end
end
end
class SuperBar
def foo
p 'super foo'
end
end
class Bar < SuperBar
include Foo
def foo
super
p 'bar'
end
end
Bar.new.foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment