Class: Sequel::ConnectionGuard::ConnectionGuard Private
- Inherits:
-
Object
- Object
- Sequel::ConnectionGuard::ConnectionGuard
- Defined in:
- lib/sequel/extensions/connection_guard/connection_guard.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.
Instance Method Summary collapse
- #force_execute {|@connection| ... } ⇒ Object private
-
#initialize(config, &initializer) ⇒ ConnectionGuard
constructor
private
A new instance of ConnectionGuard.
- #raw_handle ⇒ Object private
Constructor Details
#initialize(config, &initializer) ⇒ ConnectionGuard
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.
Returns a new instance of ConnectionGuard.
13 14 15 16 17 18 19 |
# File 'lib/sequel/extensions/connection_guard/connection_guard.rb', line 13 def initialize(config, &initializer) @config = config @initializer = initializer @connection = nil try_establish_connection end |
Instance Method Details
#force_execute {|@connection| ... } ⇒ 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.
25 26 27 28 29 30 |
# File 'lib/sequel/extensions/connection_guard/connection_guard.rb', line 25 def force_execute(&_block) try_establish_connection if @connection.nil? raise Sequel::DatabaseConnectionError unless connection_established? yield @connection end |
#raw_handle ⇒ 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.
36 37 38 39 40 41 |
# File 'lib/sequel/extensions/connection_guard/connection_guard.rb', line 36 def raw_handle try_establish_connection if @connection.nil? return @connection if connection_established? raise Sequel::DatabaseConnectionError end |