Class: ActiveRecord::AsynchronousQueriesTracker
- Inherits:
-
Object
- Object
- ActiveRecord::AsynchronousQueriesTracker
- Defined in:
- lib/active_record/asynchronous_queries_tracker.rb
Overview
:nodoc:
Defined Under Namespace
Modules: NullSession Classes: Session
Instance Attribute Summary collapse
-
#current_session ⇒ Object
readonly
Returns the value of attribute current_session.
Class Method Summary collapse
- .complete(asynchronous_queries_tracker) ⇒ Object
- .install_executor_hooks(executor = ActiveSupport::Executor) ⇒ Object
- .run ⇒ Object
Instance Method Summary collapse
- #finalize_session ⇒ Object
-
#initialize ⇒ AsynchronousQueriesTracker
constructor
A new instance of AsynchronousQueriesTracker.
- #start_session ⇒ Object
Constructor Details
#initialize ⇒ AsynchronousQueriesTracker
Returns a new instance of AsynchronousQueriesTracker.
46 47 48 |
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 46 def initialize @current_session = NullSession end |
Instance Attribute Details
#current_session ⇒ Object (readonly)
Returns the value of attribute current_session.
44 45 46 |
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 44 def current_session @current_session end |
Class Method Details
.complete(asynchronous_queries_tracker) ⇒ Object
39 40 41 |
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 39 def complete(asynchronous_queries_tracker) asynchronous_queries_tracker.finalize_session end |
.install_executor_hooks(executor = ActiveSupport::Executor) ⇒ Object
31 32 33 |
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 31 def install_executor_hooks(executor = ActiveSupport::Executor) executor.register_hook(self) end |
.run ⇒ Object
35 36 37 |
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 35 def run ActiveRecord::Base.asynchronous_queries_tracker.start_session end |
Instance Method Details
#finalize_session ⇒ Object
55 56 57 58 |
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 55 def finalize_session @current_session.finalize @current_session = NullSession end |