log_magic 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08cb4da5959a30e03917df67f8b639403bd947bd
4
- data.tar.gz: d9ae174c0a9e17c48184cfc0a6237f1cdbe1c5f2
3
+ metadata.gz: a9abdbd914641860a5b7e2be230902f925bf0095
4
+ data.tar.gz: 99afd230f8c3023a9e5cdaed8b900ee214f7885e
5
5
  SHA512:
6
- metadata.gz: 0b3a8cd289c129accc28b43e016b36db45fe90bdc488af5cc38210f397d36d9d8d6b65daa0238f90a79ae68c24345fea2dbd7fabda222ee949fdffb5a31b829b
7
- data.tar.gz: 4dfd8a42fb2e1ad61d50512429eaf0476c4ceeaae744d71f02790a1a30d8ab31bd5180b62f32f796d43f3dc634b09c43e036e405c49370f39739f8dac2820560
6
+ metadata.gz: aa4fc3271f0babc80b2d3180369100d81fbb343e3db85557be58a3273c5688225afc501c4eabe0a719aec0fdc1f55dd16c00643e8ea8fc6ed414a7167ba1a55c
7
+ data.tar.gz: 5527270c00d24bfbeecf3ac47f365f955a1e000059ab0fb1810ebbff1f036533270aac2bb24b5d15c34a6758f3b7b11190eedb24af10f19caece5ee48b5c5cf8
@@ -0,0 +1,2 @@
1
+ %a{href: 'http://www.w3schools.com/sql/sql_select.asp'}
2
+ SELECT
@@ -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
 
@@ -0,0 +1,7 @@
1
+ class LogMagic::MySqlExplainer::SelectExplainerSection
2
+ include ::LogMagic::TemplatingUtils
3
+
4
+ def term_name
5
+ 'SELECT'
6
+ end
7
+ end
@@ -1,6 +1,6 @@
1
1
  module LogMagic::TemplatingUtils
2
- def initialize(query_json)
3
- @query_json = query_json
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
- @query_json.gsub!(match_regex, rendered_template)
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.9
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