Created
July 6, 2011 15:11
-
-
Save benolee/1067470 to your computer and use it in GitHub Desktop.
easy way to do singleton modules
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 Foo | |
extend self | |
def bar | |
"hello world" | |
end | |
end | |
Foo.bar | |
#=> "hello world" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment