Created
February 25, 2010 16:43
-
-
Save itstommymorgan/314707 to your computer and use it in GitHub Desktop.
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
class Parent | |
def foo | |
puts "I'm a good parent." | |
end | |
end | |
module Interloper | |
def foo | |
puts "I've got candy in the van." | |
end | |
end | |
module NiceInterloper | |
include Interloper | |
undef foo | |
end | |
class FirstChild < Parent | |
include Interloper | |
end | |
class SecondChild < Parent | |
include NiceInterloper | |
end | |
FirstChild.new.foo # => "I've got candy in the van." | |
SecondChild.new.foo # => "I'm a good parent." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment