Class: ActiveRecord::ExplainRegistry

Inherits:
Object
  • Object
show all
Extended by:
ActiveSupport::PerThreadRegistry
Defined in:
lib/active_record/explain_registry.rb

Overview

This is a thread locals registry for EXPLAIN. For example

ActiveRecord::ExplainRegistry.queries

returns the collected queries local to the current thread.

See the documentation of ActiveSupport::PerThreadRegistry for further details.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExplainRegistry

Returns a new instance of ExplainRegistry.



19
20
21
# File 'lib/active_record/explain_registry.rb', line 19

def initialize
  reset
end

Instance Attribute Details

#collectObject

Returns the value of attribute collect.



17
18
19
# File 'lib/active_record/explain_registry.rb', line 17

def collect
  @collect
end

#queriesObject

Returns the value of attribute queries.



17
18
19
# File 'lib/active_record/explain_registry.rb', line 17

def queries
  @queries
end

Instance Method Details

#collect?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/active_record/explain_registry.rb', line 23

def collect?
  @collect
end

#resetObject



27
28
29
30
# File 'lib/active_record/explain_registry.rb', line 27

def reset
  @collect = false
  @queries = []
end