Skip to content

Instantly share code, notes, and snippets.

@jmeridth
Created January 9, 2010 21:44
Show Gist options
  • Save jmeridth/273123 to your computer and use it in GitHub Desktop.
Save jmeridth/273123 to your computer and use it in GitHub Desktop.
module MyModule
def my_method; 'hello' ; end
end
class MyClass
class << self
include MyModule
end
end
MyClass.my_method # => "hello"
#IS EQUIVALENT TO
module MyModule
def my_method; 'hello' ; end
end
class MyClass
extend MyModule
end
MyClass.my_method # => "hello"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment