Created
June 12, 2018 14:22
-
-
Save somethvictory/58bce9e8ad5feeaef9c700f932383fef to your computer and use it in GitHub Desktop.
Sample singleton in Ruby
This file contains hidden or 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
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