Skip to content

Instantly share code, notes, and snippets.

@somethvictory
Created June 12, 2018 14:22
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 somethvictory/58bce9e8ad5feeaef9c700f932383fef to your computer and use it in GitHub Desktop.
Save somethvictory/58bce9e8ad5feeaef9c700f932383fef to your computer and use it in GitHub Desktop.
Sample singleton in Ruby
class ServerConnection
include Singleton
def connection
@connection ||= Server.new(
key: ENV['ACCESS_KEY'],
host: ENV['HOST'],
username: ENV['USERNAME']
)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment