Class: LogMagic::MySqlExplainer::QueryExplainerSection

Inherits:
Object
  • Object
show all
Includes:
TemplatingUtils
Defined in:
lib/log_magic/explainers/mysql/query_explainer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TemplatingUtils

#enriche, #match_regex, #rendered_template, #template_dir, #template_path

Constructor Details

#initialize(mysql_query) ⇒ QueryExplainerSection

Returns a new instance of QueryExplainerSection.



5
6
7
# File 'lib/log_magic/explainers/mysql/query_explainer.rb', line 5

def initialize(mysql_query)
  @mysql_query = mysql_query
end

Instance Attribute Details

#mysql_queryObject (readonly)

Returns the value of attribute mysql_query.



3
4
5
# File 'lib/log_magic/explainers/mysql/query_explainer.rb', line 3

def mysql_query
  @mysql_query
end

Instance Method Details

#enriche_mysql_queryObject



26
27
28
29
30
31
32
# File 'lib/log_magic/explainers/mysql/query_explainer.rb', line 26

def enriche_mysql_query
  explainer_section_classes.map do |explainer_section_class|
    explainer_section_class.new(mysql_query)
  end.each do |explainer_section|
    explainer_section.enriche
  end
end

#explainer_section_classesObject



17
18
19
20
21
22
23
24
# File 'lib/log_magic/explainers/mysql/query_explainer.rb', line 17

def explainer_section_classes
  [
    ::LogMagic::MySqlExplainer::IsNullExplainerSection,
    ::LogMagic::MySqlExplainer::OrderByExplainerSection,
    ::LogMagic::MySqlExplainer::WhereExplainerSection,
    ::LogMagic::MySqlExplainer::SelectExplainerSection
  ]
end

#explanationObject



9
10
11
# File 'lib/log_magic/explainers/mysql/query_explainer.rb', line 9

def explanation
  rendered_template
end

#template_nameObject



13
14
15
# File 'lib/log_magic/explainers/mysql/query_explainer.rb', line 13

def template_name
  'query.haml'
end