nutmeg 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 839f3094a2c5de6f59f396e3c31a456c2910cee0
4
- data.tar.gz: c58024fe9671ff83ab4a3e6b6104b6b440999ead
3
+ metadata.gz: b68dde6b721ba5628dd4c0f11b27baf1088a9a73
4
+ data.tar.gz: 07ec3c8770abb0d8083f73750669fbdd42ecbfee
5
5
  SHA512:
6
- metadata.gz: f2a22c789b3eb03b59c21069ec5408e5ada70dcaa21d6b3dafa44bb9917933b062a8e92ede09544ad6b737598e842ba7b1252655fc540f9db62c315069c90d55
7
- data.tar.gz: 3908dcf8684c2e9b53e33182001586acf4ae8bc162a600caa9abfc1ed014225d6465e804874cf6bd4a949e58f36fb4da7a37f43bcdb3b9b3a4c76771441e4fed
6
+ metadata.gz: fb84459fa571a321194c60b9286bd319aa88a03d66081ccbf42dd827fdb51f8f3b7b6a71adb577c3d71ba9a8801486a8c7b105d412959f296ca886661304e4b0
7
+ data.tar.gz: 50d53ebfb824495c3bdfcb382f6cc44c67431c090517f45963d0026ff588f48e9500bed9f5de9f54456f92b178a0122b6051462a38452afb8b15b5cf37716f92
@@ -14,8 +14,8 @@ module Nutmeg
14
14
  end
15
15
 
16
16
  def get_paths(tags_given)
17
- start_nodes = @original.children.select{|l| tags_given.include?(l.content[:tag_id])}
18
- end_nodes = @original.each_leaf.select{|l| tags_given.include?(l.content[:tag_id])}
17
+ start_nodes = @original.children.select{|l| tags_given.include?(l.content[:slug])}
18
+ end_nodes = @original.each_leaf.select{|l| tags_given.include?(l.content[:slug])}
19
19
 
20
20
  end_nodes.select do |end_node|
21
21
  (end_node.parentage & start_nodes).count >= 1
@@ -23,7 +23,7 @@ module Nutmeg
23
23
  ([leaf] + leaf.parentage).reverse
24
24
  end.select do |path|
25
25
  # we always include the 'root' tag
26
- (path.map{|tag| tag.content[:tag_id] } - tags_given).count == 1
26
+ (path.map{|tag| tag.content[:slug] } - tags_given).count == 1
27
27
  end
28
28
  end
29
29
 
@@ -49,7 +49,7 @@ module Nutmeg
49
49
  def traverse_node?(node, tags_given)
50
50
  return true if node.is_root?
51
51
  return true if node.level == 1
52
- (node.parentage.select{|n| n.level == 1}.map{|n| n.content[:tag_id]} & tags_given).count >= 1
52
+ (node.parentage.select{|n| n.level == 1}.map{|n| n.content[:slug]} & tags_given).count >= 1
53
53
  end
54
54
  end
55
55
  end
@@ -1,3 +1,3 @@
1
1
  module Nutmeg
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -9,7 +9,7 @@ describe Nutmeg::TagTreeHelper do
9
9
  describe "#print_html" do
10
10
  it "outputs html" do
11
11
  expect(Nutmeg::TagTreeHelper.new(@tree_from_yaml.tree).print_html([1]).class).to eq(String)
12
- expect(Nutmeg::TagTreeHelper.new(@tree_from_yaml.tree).print_html([1,3,5,10])).to eq("<ul><li class='level_1 active'> <a >north</a><ul><li class='level_2 active'> <a >men</a><ul><li class='level_3 active'> <a >collections</a><ul><li class='level_4 leaf'> <a href='/north/men/collections/winter_2015'>winter_2015</a></li><li class='level_4 leaf'> <a href='/north/men/collections/spring_2015'>spring_2015</a></li><li class='level_4 leaf active'> <a href='/north/men/collections/summer_2015'>summer_2015</a></li></ul></li></ul></li><li class='level_2'> <a >women</a><ul><li class='level_3'> <a >collections</a><ul><li class='level_4 leaf'> <a href='/north/women/collections/winter_2015'>winter_2015</a></li><li class='level_4 leaf'> <a href='/north/women/collections/spring_2015'>spring_2015</a></li><li class='level_4 leaf'> <a href='/north/women/collections/summer_2015'>summer_2015</a></li></ul></li></ul></li><li class='level_2'> <a >events</a><ul><li class='level_3 leaf'> <a href='/north/events/lowlands_2014'>lowlands_2014</a></li><li class='level_3 leaf'> <a href='/north/events/sinterklaas_2014'>sinterklaas_2014</a></li></ul></li><li class='level_2'> <a >collaborations</a><ul><li class='level_3 leaf'> <a href='/north/collaborations/afro_jack'>afro_jack</a></li><li class='level_3 leaf'> <a href='/north/collaborations/pr_co'>pr_co</a></li></ul></li></ul></li><li class='level_1'> <a >south</a><ul></li></li></ul></li></ul>")
12
+ expect(Nutmeg::TagTreeHelper.new(@tree_from_yaml.tree).print_html(["north", "men", "collections", "summer_2015"])).to eq("<ul><li class='level_1 active'> <a >north</a><ul><li class='level_2 active'> <a >men</a><ul><li class='level_3 active'> <a >collections</a><ul><li class='level_4 leaf'> <a href='/north/men/collections/winter_2015'>winter_2015</a></li><li class='level_4 leaf'> <a href='/north/men/collections/spring_2015'>spring_2015</a></li><li class='level_4 leaf active'> <a href='/north/men/collections/summer_2015'>summer_2015</a></li></ul></li></ul></li><li class='level_2'> <a >women</a><ul><li class='level_3'> <a >collections</a><ul><li class='level_4 leaf'> <a href='/north/women/collections/winter_2015'>winter_2015</a></li><li class='level_4 leaf'> <a href='/north/women/collections/spring_2015'>spring_2015</a></li><li class='level_4 leaf'> <a href='/north/women/collections/summer_2015'>summer_2015</a></li></ul></li></ul></li><li class='level_2'> <a >events</a><ul><li class='level_3 leaf'> <a href='/north/events/lowlands_2014'>lowlands_2014</a></li><li class='level_3 leaf'> <a href='/north/events/sinterklaas_2014'>sinterklaas_2014</a></li></ul></li><li class='level_2'> <a >collaborations</a><ul><li class='level_3 leaf'> <a href='/north/collaborations/afro_jack'>afro_jack</a></li><li class='level_3 leaf'> <a href='/north/collaborations/pr_co'>pr_co</a></li></ul></li></ul></li><li class='level_1'> <a >south</a><ul></li></li></ul></li></ul>")
13
13
  end
14
14
  end
15
15
  end
@@ -27,7 +27,7 @@ describe Nutmeg::TagTree do
27
27
 
28
28
  describe "#get_paths_formatted" do
29
29
  it "returns base/child when using [1,2] as selector" do
30
- expect(@tag_tree.get_paths_formatted([1,2]).first).to eq("base/child")
30
+ expect(@tag_tree.get_paths_formatted(["base", "child"]).first).to eq("base/child")
31
31
  end
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nutmeg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2014-09-08 00:00:00.000000000 Z
11
+ date: 2014-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubytree