Class: ActiveRecord::AsynchronousQueriesTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/asynchronous_queries_tracker.rb

Overview

:nodoc:

Defined Under Namespace

Modules: NullSession Classes: Session

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAsynchronousQueriesTracker

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_sessionObject (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

.runObject



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_sessionObject



55
56
57
58
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 55

def finalize_session
  @current_session.finalize
  @current_session = NullSession
end

#start_sessionObject



50
51
52
53
# File 'lib/active_record/asynchronous_queries_tracker.rb', line 50

def start_session
  @current_session = Session.new
  self
end