Skip to content

Instantly share code, notes, and snippets.

@rosylilly
Last active December 31, 2015 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosylilly/8013662 to your computer and use it in GitHub Desktop.
Save rosylilly/8013662 to your computer and use it in GitHub Desktop.
ask.fm への解答
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