Skip to content

Instantly share code, notes, and snippets.

@willnet
Created November 2, 2018 13:14
Show Gist options
  • Save willnet/23522a5fbdec65cde206b09f353f27a7 to your computer and use it in GitHub Desktop.
Save willnet/23522a5fbdec65cde206b09f353f27a7 to your computer and use it in GitHub Desktop.
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