Class: Ddr::Models::Structure
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Ddr::Models::Structure
- Defined in:
- lib/ddr/models/structure.rb
Overview
Wraps a Nokogiri (XML) Document
Class Method Summary collapse
Instance Method Summary collapse
- #as_xml_document ⇒ Object
-
#initialize(xml_doc = nil) ⇒ Structure
constructor
A new instance of Structure.
- #struct_maps ⇒ Object
- #structMap_node(type = 'default') ⇒ Object
Constructor Details
#initialize(xml_doc = nil) ⇒ Structure
Returns a new instance of Structure.
8 9 10 |
# File 'lib/ddr/models/structure.rb', line 8 def initialize(xml_doc=nil) super end |
Class Method Details
.template ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/ddr/models/structure.rb', line 40 def self.template Nokogiri::XML( '<mets xmlns="http://www.loc.gov/METS/" xmlns:xlink="http://www.w3.org/1999/xlink"> <structMap TYPE="default" /> </mets>' ) do |config| config.noblanks end end |
Instance Method Details
#as_xml_document ⇒ Object
20 21 22 |
# File 'lib/ddr/models/structure.rb', line 20 def as_xml_document __getobj__ end |
#struct_maps ⇒ Object
12 13 14 |
# File 'lib/ddr/models/structure.rb', line 12 def struct_maps @struct_maps ||= build_struct_maps(structMap_nodes) end |
#structMap_node(type = 'default') ⇒ Object
16 17 18 |
# File 'lib/ddr/models/structure.rb', line 16 def structMap_node(type='default') xpath("//xmlns:structMap[@TYPE='#{type}']").first end |