log_magic 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/log_magic/explainer_templates/mysql/SELECT.haml +2 -0
- data/lib/log_magic/explainers/mysql/query_explainer.rb +2 -2
- data/lib/log_magic/explainers/mysql/select_explainer.rb +7 -0
- data/lib/log_magic/utils/templating_utils.rb +4 -4
- metadata +3 -2
- data/lib/log_magic/explainers/msyql/query_explainer.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9abdbd914641860a5b7e2be230902f925bf0095
|
4
|
+
data.tar.gz: 99afd230f8c3023a9e5cdaed8b900ee214f7885e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa4fc3271f0babc80b2d3180369100d81fbb343e3db85557be58a3273c5688225afc501c4eabe0a719aec0fdc1f55dd16c00643e8ea8fc6ed414a7167ba1a55c
|
7
|
+
data.tar.gz: 5527270c00d24bfbeecf3ac47f365f955a1e000059ab0fb1810ebbff1f036533270aac2bb24b5d15c34a6758f3b7b11190eedb24af10f19caece5ee48b5c5cf8
|
@@ -4,7 +4,6 @@ class LogMagic::MySqlExplainer::QueryExplainerSection
|
|
4
4
|
|
5
5
|
def initialize(mysql_query)
|
6
6
|
@mysql_query = mysql_query
|
7
|
-
enriche_mysql_query
|
8
7
|
end
|
9
8
|
|
10
9
|
def explanation
|
@@ -17,7 +16,8 @@ class LogMagic::MySqlExplainer::QueryExplainerSection
|
|
17
16
|
|
18
17
|
def explainer_section_classes
|
19
18
|
[
|
20
|
-
::LogMagic::MySqlExplainer::WhereExplainerSection
|
19
|
+
::LogMagic::MySqlExplainer::WhereExplainerSection,
|
20
|
+
::LogMagic::MySqlExplainer::SelectExplainerSection
|
21
21
|
]
|
22
22
|
end
|
23
23
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module LogMagic::TemplatingUtils
|
2
|
-
def initialize(
|
3
|
-
@
|
2
|
+
def initialize(object_to_enriche)
|
3
|
+
@object_to_enriche = object_to_enriche
|
4
4
|
end
|
5
5
|
|
6
6
|
def rendered_template
|
@@ -17,11 +17,11 @@ module LogMagic::TemplatingUtils
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def enriche
|
20
|
-
@
|
20
|
+
@object_to_enriche.gsub!(match_regex, rendered_template)
|
21
21
|
end
|
22
22
|
|
23
23
|
def match_regex
|
24
|
-
/[^\w]#{term_name}[^\w]/
|
24
|
+
/(?:[^\w]|\A)#{term_name}[^\w]/
|
25
25
|
end
|
26
26
|
|
27
27
|
def template_name
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_magic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Korfmann
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- bin/rebuild
|
135
135
|
- lib/log_magic.rb
|
136
136
|
- lib/log_magic/explainer_templates/mysql.haml
|
137
|
+
- lib/log_magic/explainer_templates/mysql/SELECT.haml
|
137
138
|
- lib/log_magic/explainer_templates/mysql/WHERE.haml
|
138
139
|
- lib/log_magic/explainer_templates/mysql/query.haml
|
139
140
|
- lib/log_magic/explainer_templates/searchkick.haml
|
@@ -147,8 +148,8 @@ files:
|
|
147
148
|
- lib/log_magic/explainer_templates/searchkick/query.haml
|
148
149
|
- lib/log_magic/explainer_templates/searchkick/settings.haml
|
149
150
|
- lib/log_magic/explainers/base_explainer.rb
|
150
|
-
- lib/log_magic/explainers/msyql/query_explainer.rb
|
151
151
|
- lib/log_magic/explainers/mysql/query_explainer.rb
|
152
|
+
- lib/log_magic/explainers/mysql/select_explainer.rb
|
152
153
|
- lib/log_magic/explainers/mysql/where_explainer.rb
|
153
154
|
- lib/log_magic/explainers/mysql_explainer.rb
|
154
155
|
- lib/log_magic/explainers/searchkick/_all_explainer.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class LogMagic::MySqlExplainer::QueryExplainerSection
|
2
|
-
include ::LogMagic::TemplatingUtils
|
3
|
-
attr_reader :mysql_query
|
4
|
-
|
5
|
-
def initialize(query_json)
|
6
|
-
@mysql_query = mysql_query
|
7
|
-
enriche_mysql_query
|
8
|
-
end
|
9
|
-
|
10
|
-
def explanation
|
11
|
-
rendered_template
|
12
|
-
end
|
13
|
-
|
14
|
-
def template_name
|
15
|
-
'query.haml'
|
16
|
-
end
|
17
|
-
|
18
|
-
def explainer_section_classes
|
19
|
-
[
|
20
|
-
::LogMagic::MySqlExplainer::WhereExplainerSection
|
21
|
-
]
|
22
|
-
end
|
23
|
-
|
24
|
-
def enriche_mysql_query
|
25
|
-
explainer_section_classes.map do |explainer_section_class|
|
26
|
-
explainer_section_class.new(mysql_query)
|
27
|
-
end.each do |explainer_section|
|
28
|
-
explainer_section.enriche
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|