Skip to content

Instantly share code, notes, and snippets.

@spp
Created October 26, 2009 07:39
Show Gist options
  • Save spp/218486 to your computer and use it in GitHub Desktop.
Save spp/218486 to your computer and use it in GitHub Desktop.
module FooModule
def say_hello
"Hello!"
end
end
class FooClass
include FooModule
end
FooClass.new.say_hello
# Hello!
module BarModule
def say_hello
"Hello from class!"
end
end
class FooClass
extend BarModule
end
FooClass.say_hello
# Hello from class!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment