Skip to content

Instantly share code, notes, and snippets.

@brianstorti
Created November 9, 2011 01:23
Show Gist options
  • Save brianstorti/1350008 to your computer and use it in GitHub Desktop.
Save brianstorti/1350008 to your computer and use it in GitHub Desktop.
extend and include
module Test
def class_method
"class method"
end
end
class A
extend Test
end
puts A.class_method
#extend is basically a shortcut for including a module to the eigenclass:
class B
class << self
include Test
end
end
puts B.class_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment