explain_parser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/explain_parser.rb +3 -10
- data/lib/explain_parser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b378add84a166f6ea03bae37fd7a5562653a1ec3
|
4
|
+
data.tar.gz: 87bcdd2937dcc0ffdba71176a6fa8d6b053efc09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1aad33d419ca56780dafe66013700bfd47fa505121c5ddf1fc8f83ad6dfb6ff4f7b8a5f6f8a41f1c979ce3a6c1e69fe48b1d4e4a50cec0e80f4632992fde44e9
|
7
|
+
data.tar.gz: ebed37694ba95d7656bcb27f9697de635748a4bcc16b715f800845bff196314e21b545a975fe5596d215afb7f104a684b8b375824eaf266f2997a6f57644371d
|
data/lib/explain_parser.rb
CHANGED
@@ -86,14 +86,7 @@ class ExplainParser
|
|
86
86
|
case val
|
87
87
|
when String
|
88
88
|
stripped_value = val.strip
|
89
|
-
|
90
|
-
when 'NULL'
|
91
|
-
nil
|
92
|
-
when /\d+/
|
93
|
-
stripped_value.to_i
|
94
|
-
else
|
95
|
-
stripped_value
|
96
|
-
end
|
89
|
+
stripped_value == 'NULL' ? nil : stripped_value
|
97
90
|
else
|
98
91
|
val
|
99
92
|
end
|
@@ -107,7 +100,7 @@ class ExplainParser
|
|
107
100
|
|
108
101
|
def build
|
109
102
|
values_list.reduce([]) do |explains, values|
|
110
|
-
params = keys.zip(cleanup_values(values)).inject({}) { |h, (k, v)| h[k] = v; h }
|
103
|
+
params = keys.zip(cleanup_values(values)).inject({}) { |h, (k, v)| h[k.downcase] = v; h }
|
111
104
|
explains << ExplainParser::Explain.new(params)
|
112
105
|
explains
|
113
106
|
end
|
@@ -143,7 +136,7 @@ class ExplainParser
|
|
143
136
|
end
|
144
137
|
|
145
138
|
def keys()
|
146
|
-
@keys ||= rows[0].chomp.split('|').compact.map(&:strip).reject(&:empty?)
|
139
|
+
@keys ||= rows[0].chomp.split('|').compact.map(&:strip).reject(&:empty?)
|
147
140
|
end
|
148
141
|
|
149
142
|
def values_list()
|