lib/ddr/models/structure.rb in ddr-models-2.0.0.pre.2 vs lib/ddr/models/structure.rb in ddr-models-2.0.0.pre.3
- old
+ new
@@ -7,35 +7,35 @@
def initialize(xml_doc=nil)
super
end
- def struct_divs
- @struct_divs ||= build_struct_divs(structMaps)
+ def struct_maps
+ @struct_maps ||= build_struct_maps(structMap_nodes)
end
- def structMap(type='default')
+ def structMap_node(type='default')
xpath("//xmlns:structMap[@TYPE='#{type}']").first
end
def as_xml_document
__getobj__
end
private
- def structMaps
+ def structMap_nodes
xpath("//xmlns:structMap")
end
- def build_struct_divs(structMaps)
- sdivs = {}
- structMaps.each do |structMap|
- type = structMap['TYPE'] || 'default'
- raise StandardError, "Multiple '#{type}' structMaps" if sdivs[type].present?
- sdivs[type] = Ddr::Models::StructDiv.new(structMap)
+ def build_struct_maps(structMap_nodes)
+ smaps = {}
+ structMap_nodes.each do |structMap_node|
+ type = structMap_node['TYPE'] || 'default'
+ raise StandardError, "Multiple '#{type}' structMaps" if smaps[type].present?
+ smaps[type] = Ddr::Models::StructDiv.new(structMap_node)
end
- sdivs
+ smaps
end
def self.template
Nokogiri::XML(
'<mets xmlns="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink">
\ No newline at end of file