Sha256: 6d2dd1f5a25435f8d36c17b31c53e2cee3830328cb825a309249974597aa5f06

Contents?: true

Size: 514 Bytes

Versions: 12

Compression:

Stored size: 514 Bytes

Contents

# A ConnectionObject belongs to a connection. It's like a singleton for each connection.
#
# Author:: Andre Kullmann
#
class ConnectionObject
  def self.get
    result = ActiveRecord::Base.connection.connection_listeners.select { |l| l.class == self }.first
    unless result
      result = new
      ActiveRecord::Base.connection.connection_listeners << result
    end
    result
  end

  def before_close
    close
    ActiveRecord::Base.connection.connection_listeners.delete(self)
  end

  def close
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerecord_bulkoperation-0.2.3 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.2.2 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.2.1 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.2.0 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.1.0 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.8 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.7 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.6 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.5 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.4 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.3 lib/activerecord_bulkoperation/util/connection_object.rb
activerecord_bulkoperation-0.0.2 lib/activerecord_bulkoperation/util/connection_object.rb