Class: ActiveRecord::ExplainRegistry

Inherits:
Object
  • Object
show all
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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExplainRegistry

Returns a new instance of ExplainRegistry.



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

def initialize
  reset
end

Instance Attribute Details

#collectObject

Returns the value of attribute collect.



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

def collect
  @collect
end

#queriesObject (readonly)

Returns the value of attribute queries.



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

def queries
  @queries
end

Instance Method Details

#collect?Boolean

Returns:

  • (Boolean)


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

def collect?
  @collect
end

#resetObject



32
33
34
35
# File 'lib/active_record/explain_registry.rb', line 32

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