Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# I need class C to call the foo method for each module included
# that has the method foo. Order does not matter as much as each
# method getting called. alias method chain?
module A
def foo
super
puts 'a'
end
end
module B
def foo
super
puts 'b'
end
end
class C
include A
include B
def foo
super
puts 'c'
end
end
C.new.foo
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.