nutmeg 0.0.14 → 0.0.15

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: 0e145e3d4136c3bd7cc1d23db79957c83b23b0f5
4
- data.tar.gz: e3ad9a629fa986c8ba291a014e236bb90559863d
3
+ metadata.gz: 45bc0ab6b0e5f0b93afd8dded9a9379ad8ec521d
4
+ data.tar.gz: 0e05ab2cf1ac11e2758550f26d95c7569b9f2b45
5
5
  SHA512:
6
- metadata.gz: 3a9a4d28872b0857bc802df4ec58b2567bd5d86ff12a5c4d00bdf6b3984e90cec98d05383bfe129a4006a9bcf6d1956be57da3b528d4ea2b8ac1082668227fa0
7
- data.tar.gz: 0ffefd4c51cb0b276428b3506e58f579b47875cdc3db8f9396201ae1d49abd9d35175c61d20c86063b55fdbcda806ac9ebcf197eb044ce55000897c725ced285
6
+ metadata.gz: 9710faf0aee7300ef59df18fa4d507ba15e597af38afbbd9e013ea61f59732465b9f8078f5597914dee598a02e8102df8bc641ec715f6f0b274003ba18ef2f62
7
+ data.tar.gz: 5900b9396108b3dbc0bca967bca05c877114749482567c52fab68abffc855a485909d901903a7e059840471e65052dda2f74655c6e2b295a3705e7f1a89d3465
data/.travis.yml CHANGED
@@ -3,4 +3,5 @@ rvm:
3
3
  - "1.9.3"
4
4
  - "2.0.0"
5
5
  - "2.1.1"
6
- - "2.1.2"
6
+ - "2.1.2"
7
+ - "2.2.0"
@@ -36,11 +36,11 @@ module Nutmeg
36
36
 
37
37
  def get_path_to_node(tag_slug, path_so_far = [])
38
38
  node = @original.select{|node|node.content[:slug] == tag_slug}.first
39
- return get_recursive_path_to_node(node, [node])
39
+ return get_recursive_path_to_node(node, [node]).reverse
40
40
  end
41
41
 
42
42
  def get_recursive_path_to_node(node, path_so_far)
43
- return path_so_far if node.parent.nil?
43
+ return path_so_far if node.parent.nil? || node.parent.content[:slug] == 'root'
44
44
  path_so_far << node.parent
45
45
  get_recursive_path_to_node(node.parent, path_so_far)
46
46
  end
@@ -1,3 +1,3 @@
1
1
  module Nutmeg
2
- VERSION = "0.0.14"
2
+ VERSION = "0.0.15"
3
3
  end
@@ -47,12 +47,18 @@ describe Nutmeg::TagTree do
47
47
  describe "descendant nodes" do
48
48
  it "Retrieve a path to a descendant node, given a leaf node" do
49
49
  path = @tag_tree.get_path_to_node("child")
50
- expect(path.length).to eql(3)
50
+ expect(path.length).to eql(2)
51
+ end
52
+
53
+ it "should get the path from the root to the leaf, not the other way round" do
54
+ path = @tag_tree.get_path_to_node("child")
55
+ expect(path.last.content[:slug]).to eql("child")
56
+ expect(path.first.content[:slug]).to eql("base")
51
57
  end
52
58
 
53
59
  it "Retrieve a path to a descendant node, given a middle-tree node" do
54
60
  path = @tag_tree.get_path_to_node("base")
55
- expect(path.length).to eql(2)
61
+ expect(path.length).to eql(1)
56
62
  end
57
63
  end
58
64
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutmeg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis van der Vliet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubytree
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.3'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Make creating trees in rails easier and close to fun
@@ -73,9 +73,9 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .rspec
78
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
79
  - Gemfile
80
80
  - LICENSE.txt
81
81
  - README.md
@@ -107,17 +107,17 @@ require_paths:
107
107
  - lib
108
108
  required_ruby_version: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - '>='
110
+ - - ">="
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  requirements: []
119
119
  rubyforge_project:
120
- rubygems_version: 2.1.9
120
+ rubygems_version: 2.2.2
121
121
  signing_key:
122
122
  specification_version: 4
123
123
  summary: Easy trees in rails