Skip to content

Instantly share code, notes, and snippets.

Created September 1, 2012 17:33
Show Gist options
  • Save anonymous/5da243ed0926a7a2f7b8 to your computer and use it in GitHub Desktop.
Save anonymous/5da243ed0926a7a2f7b8 to your computer and use it in GitHub Desktop.
# Define the module
module MyModule
def say_hello
puts 'Hello!'
end
# This below method will be run when this module is included in another class.
def self.included(base)
base.extend(self)
end
end
class MyClass
include MyModule
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment