class Train::Transports::Docker
Patched train transport with Windows support for InSpec verifier
Public Instance Methods
connection(state = {}, &block)
click to toggle source
# File lib/train/docker.rb, line 27 def connection(state = {}, &block) opts = merge_options(options, state || {}) validate_options(opts) if @connection && @connection_options == opts reuse_connection(&block) else create_new_connection(opts, &block) end end
Private Instance Methods
create_new_connection(options, &block)
click to toggle source
Creates a new Docker
connection instance and save it for potential future reuse.
@param options [Hash] connection options @return [Docker::Connection] a Docker
connection instance @api private
# File lib/train/docker.rb, line 46 def create_new_connection(options, &block) if @connection logger.debug("[Docker] shutting previous connection #{@connection}") @connection.close end @connection_options = options @connection = Connection.new(options, &block) end
reuse_connection() { |connection| ... }
click to toggle source