elasticsearch-explain-response 0.2.2 → 0.2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df103068b5f7a7ecbb4aedc891170f4694de2306
|
4
|
+
data.tar.gz: a12e87ba1be8f777d975797f0e7a48719696f555
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02147c8d3dfbcf889dc90daac3c2820e343dcf53421a095f2ff46e2eecc1b1040fb420f6d7b0df7b9643621c0c0d32569073d511766d27df6910224183daf143
|
7
|
+
data.tar.gz: c77fb47e745a90012425c93c03abb1014926705c85ae954f4aa0bb8eb1b32517d991e68fa8c318175e550589647b21b3c746f1ac8f6ac37eaace8e9752425c7c
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "elasticsearch-explain-response"
|
7
|
-
spec.version = "0.2.
|
7
|
+
spec.version = "0.2.3"
|
8
8
|
spec.authors = ["Tomoya Hirano"]
|
9
9
|
spec.email = ["hiranotomoya@gmail.com"]
|
10
10
|
spec.summary = %q{Parser for Elasticserach Explain response}
|
@@ -45,7 +45,7 @@ module Elasticsearch
|
|
45
45
|
attr_reader :explain, :trim, :rendering_options
|
46
46
|
|
47
47
|
def initialize(explain, options = {})
|
48
|
-
@explain = explain
|
48
|
+
@explain = explain || {}
|
49
49
|
@indent = 0
|
50
50
|
@trim = options.has_key?(:trim) ? options.delete(:trim) : true
|
51
51
|
@rendering_options = options
|
@@ -7,24 +7,27 @@ describe Elasticsearch::API::Response::ExplainResponse do
|
|
7
7
|
end
|
8
8
|
|
9
9
|
describe '.render_in_line' do
|
10
|
-
|
11
|
-
|
10
|
+
context "with explain" do
|
11
|
+
it "returns summary" do
|
12
|
+
result = described_class.render_in_line(fake_response)
|
13
|
+
expect(result).not_to be_empty
|
14
|
+
end
|
12
15
|
end
|
13
16
|
|
14
|
-
|
15
|
-
|
17
|
+
context "with empty explain" do
|
18
|
+
it "returns summary" do
|
19
|
+
result = described_class.render_in_line({}, colorize: false)
|
20
|
+
expect(result).to eq("0.0 = ")
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
context "with block" do
|
19
|
-
|
20
|
-
described_class.render_in_line(fake_response, colorize: false) do |tree|
|
25
|
+
it "changes the tree before rendering" do
|
26
|
+
result = described_class.render_in_line(fake_response, colorize: false) do |tree|
|
21
27
|
tree.children = tree.children[0..1]
|
22
28
|
tree
|
23
29
|
end
|
24
|
-
|
25
|
-
|
26
|
-
it "changes the tree before rendering" do
|
27
|
-
expect(subject).to eq("0.05 = (0.11(score) x 0.5(coord(1/2)))")
|
30
|
+
expect(result).to eq("0.05 = (0.11(score) x 0.5(coord(1/2)))")
|
28
31
|
end
|
29
32
|
end
|
30
33
|
end
|