Skip to content

Instantly share code, notes, and snippets.

@JulesWang
Created June 6, 2011 07:00
Show Gist options
  • Save JulesWang/1009842 to your computer and use it in GitHub Desktop.
Save JulesWang/1009842 to your computer and use it in GitHub Desktop.
singleton pattern by ruby
require 'singleton'
class Single
include Singleton
#...
end
single = Single.instance
# private method `new' called for Single:Class (NoMethodError)
# single = Single.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment