-
-
Save havenwood/b290ce4db82b41f5a9b501dbec447b1b to your computer and use it in GitHub Desktop.
example singleton for thadtheman on irc
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 Test | |
include Singleton | |
def initialize | |
@name = 'thadtheman' | |
end | |
def a | |
@name | |
end | |
end | |
Test.instance.a | |
#=> "thadtheman" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment