Skip to content

Instantly share code, notes, and snippets.

@hosh
Created April 21, 2010 23:50
Show Gist options
  • Save hosh/374602 to your computer and use it in GitHub Desktop.
Save hosh/374602 to your computer and use it in GitHub Desktop.
module Animal
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
def say
"animal"
end
end
end
class Slug
include Animal
end
class Cat
def self.say
"meow"
end
end
class Dog
class << self
def say
"woof"
end
end
end
Slug.say
Cat.say
Dog.say
Cat.send(:include, Animal)
Cat.say
Dog.send(:include, Animal)
Dog.say
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment