Class: ActiveRecord::ExplainRegistry
- Inherits:
-
Object
- Object
- ActiveRecord::ExplainRegistry
- 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.
Defined Under Namespace
Classes: Subscriber
Instance Attribute Summary collapse
-
#collect ⇒ Object
Returns the value of attribute collect.
-
#queries ⇒ Object
readonly
Returns the value of attribute queries.
Instance Method Summary collapse
- #collect? ⇒ Boolean
-
#initialize ⇒ ExplainRegistry
constructor
A new instance of ExplainRegistry.
- #reset ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize ⇒ ExplainRegistry
68 69 70 |
# File 'lib/active_record/explain_registry.rb', line 68 def initialize reset end |
Instance Attribute Details
#collect ⇒ Object
Returns the value of attribute collect.
65 66 67 |
# File 'lib/active_record/explain_registry.rb', line 65 def collect @collect end |
#queries ⇒ Object (readonly)
Returns the value of attribute queries.
66 67 68 |
# File 'lib/active_record/explain_registry.rb', line 66 def queries @queries end |
Instance Method Details
#collect? ⇒ Boolean
77 78 79 |
# File 'lib/active_record/explain_registry.rb', line 77 def collect? @collect end |
#reset ⇒ Object
81 82 83 84 |
# File 'lib/active_record/explain_registry.rb', line 81 def reset @collect = false @queries = [] end |
#start ⇒ Object
72 73 74 75 |
# File 'lib/active_record/explain_registry.rb', line 72 def start Subscriber.ensure_subscribed @collect = true end |