Class: Woods::Console::SafeContext::SingleConnectionPool Private

Inherits:
Struct
  • Object
show all
Defined in:
lib/woods/console/safe_context.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Thin adapter that makes a bare connection look like a connection pool with a ‘with_connection` interface. Used internally when callers pass `connection:` so that #execute always flows through a single code path regardless of construction form.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connectionObject

Returns the value of attribute connection

Returns:

  • (Object)

    the current value of connection



102
103
104
# File 'lib/woods/console/safe_context.rb', line 102

def connection
  @connection
end

Instance Method Details

#with_connection {|Object| ... } ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Yields:

  • (Object)

    the wrapped connection



104
105
106
# File 'lib/woods/console/safe_context.rb', line 104

def with_connection(&block)
  block.call(connection)
end