Class: MetsConverter::MetsParser
- Inherits:
-
Object
- Object
- MetsConverter::MetsParser
- Defined in:
- lib/mets_converter/mets_parser.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
- #capture_date ⇒ Object
-
#initialize(file) ⇒ MetsParser
constructor
A new instance of MetsParser.
- #input_file_location ⇒ Object
- #pages ⇒ Object
Constructor Details
#initialize(file) ⇒ MetsParser
Returns a new instance of MetsParser.
7 8 9 10 |
# File 'lib/mets_converter/mets_parser.rb', line 7 def initialize(file) @file = file @document = parse_xml end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
5 6 7 |
# File 'lib/mets_converter/mets_parser.rb', line 5 def document @document end |
Instance Method Details
#capture_date ⇒ Object
16 17 18 |
# File 'lib/mets_converter/mets_parser.rb', line 16 def capture_date document.xpath('//xmlns:metsHdr')[0].attr('CREATEDATE') + '-06:00' end |
#input_file_location ⇒ Object
12 13 14 |
# File 'lib/mets_converter/mets_parser.rb', line 12 def input_file_location File.dirname(@file) end |
#pages ⇒ Object
20 21 22 |
# File 'lib/mets_converter/mets_parser.rb', line 20 def pages document.search('structMap[@TYPE="logical"]//div[@TYPE="page"]') end |