Class: ActiveRecord::ConnectionAdapters::ConnectionManagement::Proxy
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#testing ⇒ Object
readonly
Returns the value of attribute testing.
Instance Method Summary collapse
- #close ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(body, testing = false) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method_sym, *arguments, &block) ⇒ Object
- #respond_to?(method_sym, include_private = false) ⇒ Boolean
Constructor Details
#initialize(body, testing = false) ⇒ Proxy
Returns a new instance of Proxy.
440 441 442 443 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 440 def initialize(body, testing = false) @body = body @testing = testing end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_sym, *arguments, &block) ⇒ Object
445 446 447 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 445 def method_missing(method_sym, *arguments, &block) @body.send(method_sym, *arguments, &block) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
438 439 440 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 438 def body @body end |
#testing ⇒ Object (readonly)
Returns the value of attribute testing
438 439 440 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 438 def testing @testing end |
Instance Method Details
#close ⇒ Object
457 458 459 460 461 462 463 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 457 def close body.close if body.respond_to?(:close) # Don't return connection (and perform implicit rollback) if # this request is a part of integration test ActiveRecord::Base.clear_active_connections! unless testing end |
#each(&block) ⇒ Object
453 454 455 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 453 def each(&block) body.each(&block) end |
#respond_to?(method_sym, include_private = false) ⇒ Boolean
449 450 451 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb', line 449 def respond_to?(method_sym, include_private = false) super || @body.respond_to?(method_sym) end |