Created
June 6, 2011 07:00
-
-
Save JulesWang/1009842 to your computer and use it in GitHub Desktop.
singleton pattern by ruby
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
require 'singleton' | |
class Single | |
include Singleton | |
#... | |
end | |
single = Single.instance | |
# private method `new' called for Single:Class (NoMethodError) | |
# single = Single.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment