Created
February 26, 2013 05:16
-
-
Save tuxido-feynman/5036094 to your computer and use it in GitHub Desktop.
Ruby Singleton... not that exciting
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
#Singleton class for interview practice | |
require 'singleton' | |
class InterviewSingleton | |
include Singleton | |
def iterate | |
@iterator ? @iterator += 1 : @iterator = 0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment