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.



124
125
126
127
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 124

def initialize
  @connection = nil
  @sticky = nil
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



122
123
124
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 122

def connection
  @connection
end

#stickyObject

Returns the value of attribute sticky.



122
123
124
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 122

def sticky
  @sticky
end

Instance Method Details

#clear(connection) ⇒ Object



136
137
138
139
140
141
142
143
144
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 136

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

#releaseObject



129
130
131
132
133
134
# File 'lib/active_record/connection_adapters/abstract/connection_pool.rb', line 129

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