Class: Safelylaunch::MockConnection
- Inherits:
-
Object
- Object
- Safelylaunch::MockConnection
- Defined in:
- lib/safelylaunch/mock_connection.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
readonly
Returns the value of attribute api_token.
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #get(key) ⇒ Object
-
#initialize(api_token:, toggles: {}, logger: Logger.new(STDOUT), host: 'http://localhost:2300') ⇒ MockConnection
constructor
A new instance of MockConnection.
Constructor Details
#initialize(api_token:, toggles: {}, logger: Logger.new(STDOUT), host: 'http://localhost:2300') ⇒ MockConnection
Returns a new instance of MockConnection.
5 6 7 8 9 10 11 |
# File 'lib/safelylaunch/mock_connection.rb', line 5 def initialize(api_token:, toggles: {}, logger: Logger.new(STDOUT), host: 'http://localhost:2300') @api_token = api_token @logger = logger @host = host @connection = nil @toggles = toggles end |
Instance Attribute Details
#api_token ⇒ Object (readonly)
Returns the value of attribute api_token.
3 4 5 |
# File 'lib/safelylaunch/mock_connection.rb', line 3 def api_token @api_token end |
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
3 4 5 |
# File 'lib/safelylaunch/mock_connection.rb', line 3 def connection @connection end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/safelylaunch/mock_connection.rb', line 3 def host @host end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/safelylaunch/mock_connection.rb', line 3 def logger @logger end |
Instance Method Details
#get(key) ⇒ Object
13 14 15 16 |
# File 'lib/safelylaunch/mock_connection.rb', line 13 def get(key) result = @toggles.fetch(key, false) { key: key, enable: result } end |