Last active
December 31, 2015 16:29
-
-
Save rosylilly/8013662 to your computer and use it in GitHub Desktop.
ask.fm への解答
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'unextend' | |
class Person | |
attr_accessor :husbund, :wife | |
def help(other) | |
... | |
end | |
def tell_love(other) | |
... | |
end | |
end | |
module Husbund | |
def help_with_love(wife) | |
help(wife) and tell_love(wife) | |
end | |
alias_method_chain :help, :love | |
end | |
me = Person.new | |
wife = Person.new | |
friend = Person.new | |
me.help(friend) | |
me.extend(Husbund) | |
me.help(wife) | |
me.unextend(Husbund) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment