-
-
Save anonymous/5da243ed0926a7a2f7b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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