Skip to content

Instantly share code, notes, and snippets.

@havenwood
Last active April 27, 2019 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save havenwood/b290ce4db82b41f5a9b501dbec447b1b to your computer and use it in GitHub Desktop.
Save havenwood/b290ce4db82b41f5a9b501dbec447b1b to your computer and use it in GitHub Desktop.
example singleton for thadtheman on irc
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