Skip to content

Instantly share code, notes, and snippets.

@xuncheng
Created July 24, 2014 14:44
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 xuncheng/93ccfe8a45ed24534235 to your computer and use it in GitHub Desktop.
Save xuncheng/93ccfe8a45ed24534235 to your computer and use it in GitHub Desktop.
class Parent
def say
puts "In Parent"
end
end
module A
def say
puts "In A"
super
end
end
module B
def say
puts "In B"
super
end
end
class Child < Parent
include A, B
end
# Child.ancestors
# => [Child, A, B, Parent, Object, Kernel, BasicObject]
p = Child.new
p.say
=> In A
In B
In Parent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment