Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
module M
def call
puts 'M'
super
end
end
class Parent
def call
puts 'Parent'
end
end
class Child < Parent
def call_with_me
puts 'Child'
call_without_me
end
alias_method :call_without_me, :call
alias_method :call, :call_with_me
end
class Parent
prepend M
end
Child.new.call
# Child
# Parent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment