nom-xml 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nom/xml/term.rb +5 -1
- data/lib/nom/xml/terminology.rb +4 -0
- data/lib/nom/xml/version.rb +1 -1
- data/spec/examples/mods_example_spec.rb +5 -0
- metadata +3 -3
data/lib/nom/xml/term.rb
CHANGED
@@ -24,6 +24,10 @@ module Nom::XML
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
def full_name
|
28
|
+
[parent.full_name, "term:#{name}"].join("/")
|
29
|
+
end
|
30
|
+
|
27
31
|
##
|
28
32
|
# Traverse the tree to figure out what terminology this term belongs to
|
29
33
|
# @return [Nom::XML::Terminology]
|
@@ -88,7 +92,7 @@ module Nom::XML
|
|
88
92
|
end
|
89
93
|
|
90
94
|
def to_s
|
91
|
-
|
95
|
+
%Q{#<#{self.class.to_s}:#{object_id} #{full_name} name="#{name}" xpath="#{xpath}">}
|
92
96
|
end
|
93
97
|
|
94
98
|
protected
|
data/lib/nom/xml/terminology.rb
CHANGED
data/lib/nom/xml/version.rb
CHANGED
@@ -84,6 +84,11 @@ describe "Namespaces example" do
|
|
84
84
|
subject.personal_authors.namePart.terms.map { |term|term.options[:index_as] }.flatten.should include(:type_1)
|
85
85
|
end
|
86
86
|
|
87
|
+
it "should allow you to use multiple terms to address the same node" do
|
88
|
+
t = subject.xpath('//mods:name', subject.terminology.namespaces).first.terms
|
89
|
+
t.map { |x| x.name }.should include(:author, :personal_authors)
|
90
|
+
end
|
91
|
+
|
87
92
|
it "should let you go from a terminology to nodes" do
|
88
93
|
subject.terminology.flatten.length.should == 11
|
89
94
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nom-xml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -174,7 +174,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: '0'
|
175
175
|
segments:
|
176
176
|
- 0
|
177
|
-
hash:
|
177
|
+
hash: 2818954073322895052
|
178
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
179
179
|
none: false
|
180
180
|
requirements:
|
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
segments:
|
185
185
|
- 0
|
186
|
-
hash:
|
186
|
+
hash: 2818954073322895052
|
187
187
|
requirements: []
|
188
188
|
rubyforge_project:
|
189
189
|
rubygems_version: 1.8.23
|