mirror of
https://gitlab.com/gitlab-org/gitlab-foss.git
synced 2025-08-03 16:04:30 +00:00
24 lines
474 B
Ruby
24 lines
474 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Database
|
|
class QueryAnalyzers
|
|
attr_reader :analyzers
|
|
|
|
def initialize
|
|
@analyzers = ObjectSpace.each_object(::Class).select { |c| c < Base }.map(&:new)
|
|
end
|
|
|
|
def analyze(query)
|
|
analyzers.each { |analyzer| analyzer.analyze(query) }
|
|
end
|
|
|
|
def save!
|
|
analyzers.each(&:save!)
|
|
end
|
|
end
|
|
end
|
|
|
|
Dir[File.join(File.expand_path('query_analyzers', __dir__), '*.rb')].each do |plugin|
|
|
require plugin
|
|
end
|