Skip to content

Instantly share code, notes, and snippets.

@edward
Created May 26, 2010 02:17
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 edward/413965 to your computer and use it in GitHub Desktop.
Save edward/413965 to your computer and use it in GitHub Desktop.
class MyParentClass
def something
puts "in the parent class"
end
end
module MyModule
def something
puts "in the module"
super
end
end
class MyChildClass < MyParentClass
include MyModule
def something
puts "in the child class"
super
end
end
MyChildClass.new.something
# >> in the child class
# >> in the module
# >> in the parent class
MyChildClass.ancestors # => [MyChildClass, MyModule, MyParentClass, Object, Kernel]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment