Created
October 13, 2014 09:55
-
-
Save yangxing-star/1dec53dac6906845c278 to your computer and use it in GitHub Desktop.
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 Logger | |
private_class_method :new | |
@@instance = nil | |
def info(msg) | |
puts msg | |
end | |
def self.instance | |
@@instance = new unless @@instance | |
end | |
end | |
logger = Logger.instance | |
logger.info('Hello') |
mimosa
commented
Oct 13, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment