-
-
Save j3ck/5e9cf0af9b553f06808a90813bae84cf to your computer and use it in GitHub Desktop.
This file contains hidden or 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 MyModule | |
# self here is MyModule | |
@species = "frog" | |
@color = "red polka-dotted" | |
@log = [] | |
def self.log(msg) | |
# self here is still MyModule, so the instance variables are still available | |
@log << msg | |
end | |
def self.show_log | |
puts @log.map { |m| "A #@color #@species says #{m.inspect}" } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment