Skip to content

Instantly share code, notes, and snippets.

@itstommymorgan
Created February 25, 2010 16:43
Show Gist options
  • Save itstommymorgan/314707 to your computer and use it in GitHub Desktop.
Save itstommymorgan/314707 to your computer and use it in GitHub Desktop.
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