Last active
July 25, 2017 04:22
-
-
Save Sihui/593d77e64a333b6fb5d33fdcc0ff0236 to your computer and use it in GitHub Desktop.
Design Pattern: Singleton and YOU
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
class You | |
@@instance = You.new | |
def self.instance | |
return @@instance | |
end | |
private_class_method :new | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment