Class: ConnectionObject
- Inherits:
-
Object
- Object
- ConnectionObject
- Defined in:
- lib/activerecord_bulkoperation/util/connection_object.rb
Overview
A ConnectionObject belongs to a connection. It’s like a singleton for each connection.
- Author
-
Andre Kullmann
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.get ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/activerecord_bulkoperation/util/connection_object.rb', line 6 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 |
Instance Method Details
#before_close ⇒ Object
15 16 17 18 |
# File 'lib/activerecord_bulkoperation/util/connection_object.rb', line 15 def before_close close ActiveRecord::Base.connection.connection_listeners.delete(self) end |
#close ⇒ Object
20 21 |
# File 'lib/activerecord_bulkoperation/util/connection_object.rb', line 20 def close end |