Created
March 4, 2018 18:01
-
-
Save maxdignan/93a7c4d15f4152a29c9e774cce0634a4 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
module Talkable | |
def speak(word) | |
puts word | |
end | |
end | |
class MyClass | |
def some_method | |
... | |
end | |
end | |
#MyClass can be given the ability to talk by including the Talkable module in it like so | |
class MyClass | |
include Talkable | |
end | |
MyClass.new.speak('hi') #puts 'hi' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment