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

#initialize ⇒ Lease

Returns a new instance of Lease.



162
163
164
165
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 162

def initialize
  @connection = nil
  @sticky = nil
end

Instance Attribute Details

#connection ⇒ Object

Returns the value of attribute connection.



160
161
162
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 160

def connection
  @connection
end

#sticky ⇒ Object

Returns the value of attribute sticky.



160
161
162
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 160

def sticky
  @sticky
end

Instance Method Details

#clear(connection) ⇒ Object



174
175
176
177
178
179
180
181
182
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 174

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

#release ⇒ Object



167
168
169
170
171
172
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 167

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