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: cc87191b066dfae57d24e9a43e8a80ab31650485
4
- data.tar.gz: ee742929b28634f9a8be93f4e444e341d5aaaccf
3
+ metadata.gz: df103068b5f7a7ecbb4aedc891170f4694de2306
4
+ data.tar.gz: a12e87ba1be8f777d975797f0e7a48719696f555
5
5
  SHA512:
6
- metadata.gz: d2a46822e8d8e9dec92bede0d6dfe875758d27655aa3904aa80598accf3231a62fdef635d3c0cc6012ca557facab29b1b78ad8b58c833f43c56343a3cc93ba1a
7
- data.tar.gz: 7a080f458d3b533d55443f804134065275a9fe20f26017f7fe2a135210a06f5657a115182543926cd3df58d8a357f07381395c5baf5ac2cff81b8a63d0ad2c49
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.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
@@ -6,11 +6,7 @@ module Elasticsearch
6
6
  end
7
7
 
8
8
  def trim(tree)
9
- recursive_trim(tree)
10
- end
11
-
12
- def recursive_trim(node)
13
- trim_node(node) if node.details.any?
9
+ trim_node(tree)
14
10
  end
15
11
 
16
12
  private
@@ -7,24 +7,27 @@ describe Elasticsearch::API::Response::ExplainResponse do
7
7
  end
8
8
 
9
9
  describe '.render_in_line' do
10
- subject do
11
- described_class.render_in_line(fake_response)
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
- it "returns summary" do
15
- expect(subject).not_to be_empty
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
- subject do
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
- end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-explain-response
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomoya Hirano