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.



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

def initialize
  reset
end

Instance Attribute Details

#collectObject

Returns the value of attribute collect.



15
16
17
# File 'lib/active_record/explain_registry.rb', line 15

def collect
  @collect
end

#queriesObject

Returns the value of attribute queries.



15
16
17
# File 'lib/active_record/explain_registry.rb', line 15

def queries
  @queries
end

Instance Method Details

#collect?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/active_record/explain_registry.rb', line 21

def collect?
  @collect
end

#resetObject



25
26
27
28
# File 'lib/active_record/explain_registry.rb', line 25

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