blob: b84a692b87eb62eae0a2d33701202158350d38d3 (
plain) (
tree)
|
|
require 'active_support/per_thread_registry'
module ActiveRecord
# 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 <tt>ActiveSupport::PerThreadRegistry</tt>
# for further details.
class ExplainRegistry
extend ActiveSupport::PerThreadRegistry
attr_accessor :queries, :collect
def initialize
reset
end
def collect?
@collect
end
def reset
@collect = false
@queries = []
end
end
end
|