Created
September 16, 2017 13:23
-
-
Save kopylovvlad/16539f1ccb516205b7246676ee4f4a88 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
class Database | |
@@instance = Database.new | |
def self.instance | |
return @@instance | |
end | |
private_class_method :new | |
end | |
d1 = Database.instance | |
d2 = Database.instance | |
d2.object_id == d1.object_id # true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment