dmoz_sax_doc 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.
- data/Gemfile.lock +1 -1
- data/lib/dmoz_sax/alias.rb +9 -2
- data/lib/dmoz_sax/path.rb +8 -0
- data/lib/dmoz_sax/version.rb +1 -1
- data/spec/path_spec.rb +20 -0
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/dmoz_sax/alias.rb
CHANGED
@@ -1,9 +1,16 @@
|
|
1
1
|
module DmozSax
|
2
2
|
class Alias
|
3
|
-
attr_accessor :path
|
3
|
+
attr_accessor :path
|
4
4
|
def initialize path_str
|
5
5
|
@path = DmozSax::Path.new path_str
|
6
|
-
|
6
|
+
end
|
7
|
+
|
8
|
+
def title
|
9
|
+
@path.name
|
10
|
+
end
|
11
|
+
|
12
|
+
def title= str
|
13
|
+
@path.name = str
|
7
14
|
end
|
8
15
|
end
|
9
16
|
end
|
data/lib/dmoz_sax/path.rb
CHANGED
data/lib/dmoz_sax/version.rb
CHANGED
data/spec/path_spec.rb
CHANGED
@@ -37,4 +37,24 @@ describe DmozSax::Path do
|
|
37
37
|
expect { path[0] = 'Bob' }.to raise_error
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
context "getting parent path" do
|
42
|
+
it "returns parent path" do
|
43
|
+
path = DmozSax::Path.new 'This/Topic/Path'
|
44
|
+
path.parent_path.should == 'This/Topic'
|
45
|
+
end
|
46
|
+
|
47
|
+
it "has not parent path if top level path" do
|
48
|
+
path = DmozSax::Path.new ''
|
49
|
+
path.parent_path.should be_nil
|
50
|
+
|
51
|
+
path = DmozSax::Path.new 'Top'
|
52
|
+
path.parent_path.should be_nil
|
53
|
+
end
|
54
|
+
|
55
|
+
it "follows the same rules removing index categories" do
|
56
|
+
path = DmozSax::Path.new 'Top/Topic/A/Path'
|
57
|
+
path.parent_path.should == 'Topic'
|
58
|
+
end
|
59
|
+
end
|
40
60
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dmoz_sax_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02
|
12
|
+
date: 2013-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|