Skip to content

Instantly share code, notes, and snippets.

@rakesh87
Created September 22, 2018 13:02
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 rakesh87/532f76e98def20b9367bb5576096c90b to your computer and use it in GitHub Desktop.
Save rakesh87/532f76e98def20b9367bb5576096c90b to your computer and use it in GitHub Desktop.
global config object to store shared variables
# minimal example for singleton pattern
class Configs
class << self
def instance
@instance ||= new
end
private :new
end
end
# using singleton module
require 'singleton'
class Config
include Singleton
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment