Class: ActiveRecord::ConnectionAdapters::ConnectionPool::Lease

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/connection_adapters/abstract/connection_pool.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLease

Returns a new instance of Lease.



145
146
147
148
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 145

def initialize
  @connection = nil
  @sticky = nil
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



143
144
145
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 143

def connection
  @connection
end

#stickyObject

Returns the value of attribute sticky.



143
144
145
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 143

def sticky
  @sticky
end

Instance Method Details

#clear(connection) ⇒ Object



157
158
159
160
161
162
163
164
165
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 157

def clear(connection)
  if @connection == connection
    @connection = nil
    @sticky = nil
    true
  else
    false
  end
end

#releaseObject



150
151
152
153
154
155
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 150

def release
  conn = @connection
  @connection = nil
  @sticky = nil
  conn
end