Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module A
def func
p 'A'
super
end
end
class B
def func
p 'B'
super
end
end
class C < B
def func
p 'C'
super
end
end
B.include A
p C.ancestors # [C, B, A, Object, Kernel, BasicObject]
C.new.func # "C", "B", "A", "no superclass method `func'"
module A
def func
p 'A'
super
end
end
module B
def func
p 'B'
super
end
end
class C
include B
def func
p 'C'
super
end
end
B.include A
p B.ancestors # [B, A]
# NOTE: A is missing!
p C.ancestors # [C, B, Object, Kernel, BasicObject]
C.new.func # "C", "B", "no superclass method `func'"
module A
def func
p 'A'
super
end
end
module B
include A
def func
p 'B'
super
end
end
class C
include B
def func
p 'C'
super
end
end
p B.ancestors # [B, A]
p C.ancestors # [C, B, A, Object, Kernel, BasicObject]
C.new.func # "C", "B", "A", "no superclass method `func'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.