om 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/History.textile +4 -0
- data/VERSION +1 -1
- data/lib/om/xml/properties.rb +3 -3
- data/om.gemspec +2 -2
- data/spec/unit/properties_spec.rb +14 -9
- metadata +4 -4
data/History.textile
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/lib/om/xml/properties.rb
CHANGED
@@ -263,14 +263,14 @@ module OM::XML::Properties
|
|
263
263
|
end
|
264
264
|
|
265
265
|
def property_info_for(property_ref)
|
266
|
-
if property_ref.instance_of?(Array) && property_ref.length
|
266
|
+
if property_ref.instance_of?(Array) && property_ref.length < 2
|
267
267
|
property_ref = property_ref[0]
|
268
268
|
end
|
269
269
|
if property_ref.instance_of?(Symbol)
|
270
270
|
property_info = properties[property_ref]
|
271
271
|
elsif property_ref.kind_of?(Array)
|
272
|
-
prop_ref = property_ref[
|
273
|
-
cm_name = property_ref[1]
|
272
|
+
prop_ref = property_ref[property_ref.length-2]
|
273
|
+
cm_name = property_ref[property_ref.length-1]
|
274
274
|
if properties.has_key?(prop_ref)
|
275
275
|
property_info = properties[prop_ref][:convenience_methods][cm_name]
|
276
276
|
end
|
data/om.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{om}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Zumwalt"]
|
12
|
-
s.date = %q{2010-07-
|
12
|
+
s.date = %q{2010-07-03}
|
13
13
|
s.description = %q{OM (Opinionated Metadata): A library to help you tame sprawling XML schemas like MODS. Wraps Nokogiri documents in objects with miscellaneous helper methods for doing things like retrieve generated xpath queries or look up properties based on a simplified DSL}
|
14
14
|
s.email = %q{matt.zumwalt@yourmediashelf.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -50,16 +50,19 @@ describe "OM::XML::Properties" do
|
|
50
50
|
}
|
51
51
|
|
52
52
|
property :issue, :path=>'part',
|
53
|
-
:subelements=>[:start_page, :end_page],
|
53
|
+
:subelements=>[:start_page, :end_page, :volume],
|
54
54
|
:convenience_methods => {
|
55
|
-
:volume => {:path=>"detail", :attributes=>{:type=>"volume"}},
|
56
|
-
:level => {:path=>"detail", :attributes=>{:type=>"
|
55
|
+
# :volume => {:path=>"detail", :attributes=>{:type=>"volume"}},
|
56
|
+
:level => {:path=>"detail", :attributes=>{:type=>"number"}, :default_content_path=>"number"},
|
57
57
|
# Hack to support provisional spot for start & end page (nesting was too deep for this version of OM)
|
58
58
|
:citation_start_page => {:path=>"pages", :attributes=>{:type=>"start"}},
|
59
59
|
:citation_end_page => {:path=>"pages", :attributes=>{:type=>"end"}},
|
60
60
|
:foo => {:path=>"foo", :attributes=>{:type=>"ness"}},
|
61
61
|
:publication_date => {:path=>"date"}
|
62
62
|
}
|
63
|
+
|
64
|
+
property :volume, :path=>"detail", :attributes=>{:type=>"volume"}, :subelements=>"number"
|
65
|
+
|
63
66
|
property :start_page, :path=>"extent", :attributes=>{:unit=>"pages"}, :default_content_path => "start"
|
64
67
|
property :end_page, :path=>"extent", :attributes=>{:unit=>"pages"}, :default_content_path => "end"
|
65
68
|
end
|
@@ -283,14 +286,16 @@ describe "OM::XML::Properties" do
|
|
283
286
|
|
284
287
|
marcrelator_role_builder_template = 'xml.role( :type=>\'code\', :authority=>\'marcrelator\' ) { xml.roleTerm( \'#{builder_new_value}\' ) }'
|
285
288
|
FakeOxMods.builder_template([:role], {:attributes=>{"type"=>"code", "authority"=>"marcrelator"}} ).should == marcrelator_role_builder_template
|
286
|
-
FakeOxMods.builder_template([:person,:role], {:attributes=>{"type"=>"code", "authority"=>"marcrelator"}} ).should == marcrelator_role_builder_template
|
289
|
+
FakeOxMods.builder_template([:person,:role], {:attributes=>{"type"=>"code", "authority"=>"marcrelator"}} ).should == marcrelator_role_builder_template
|
287
290
|
end
|
288
291
|
|
289
|
-
it "should work with deeply nested properties" do
|
290
|
-
|
291
|
-
|
292
|
-
FakeOxMods.builder_template([:journal, :issue, :
|
293
|
-
FakeOxMods.builder_template([:journal, :issue, :
|
292
|
+
it "should work with deeply nested properties" do
|
293
|
+
FakeOxMods.builder_template([:issue, :volume]).should == "xml.detail( '\#{builder_new_value}', :type=>'volume' )"
|
294
|
+
FakeOxMods.builder_template([:volume, :number]).should == "xml.number( '\#{builder_new_value}' )"
|
295
|
+
FakeOxMods.builder_template([:journal, :issue, :level]).should == "xml.detail( :type=>'number' ) { xml.number( '\#{builder_new_value}' ) }"
|
296
|
+
FakeOxMods.builder_template([:journal, :issue, :volume]).should == "xml.detail( '\#{builder_new_value}', :type=>'volume' )"
|
297
|
+
FakeOxMods.builder_template([:journal, :issue, :volume, :number]).should == "xml.number( '\#{builder_new_value}' )"
|
298
|
+
FakeOxMods.builder_template([:journal, :issue, :start_page]).should == "xml.extent( :unit=>'pages' ) { xml.start( '\#{builder_new_value}' ) }"
|
294
299
|
end
|
295
300
|
|
296
301
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: om
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 9
|
10
|
+
version: 0.1.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Zumwalt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-07-
|
18
|
+
date: 2010-07-03 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|