Class: Krikri::Harvesters::MarcXMLHarvester
- Inherits:
-
Object
- Object
- Krikri::Harvesters::MarcXMLHarvester
- Includes:
- Krikri::Harvester
- Defined in:
- lib/krikri/harvesters/marc_xml_harvester.rb
Overview
A harvester implementation for reading MARC XML documents from a source.
Subclasses of MarcXMLHarvester are expected to implement the following methods:
- #each_collection (yields one or more IO objects containing a MARC XML
- #collection)
Constant Summary
Constants included from Krikri::Harvester
Instance Attribute Summary
Attributes included from Krikri::Harvester
Attributes included from SoftwareAgent
Instance Method Summary collapse
-
#content_type ⇒ String
The content type for the records generated by this harvester.
- #each_collection {|Enumerable<IO>| ... } ⇒ Object abstract
-
#record_ids ⇒ Enumerator::Lazy
An enumerator of the 001 control fields from the records targeted by this harvester.
-
#records ⇒ Enumerator::Lazy
An enumerator of the records targeted by this harvester.
Methods included from Krikri::Harvester
#count, expected_opts, #get_record, #initialize, #run
Methods included from SoftwareAgent
Instance Method Details
#content_type ⇒ String
Returns the content type for the records generated by this harvester.
39 40 41 |
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 39 def content_type 'text/xml' end |
#each_collection {|Enumerable<IO>| ... } ⇒ Object
This method is abstract.
18 19 20 |
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 18 def each_collection raise NotImplementedError end |
#record_ids ⇒ Enumerator::Lazy
Returns an enumerator of the 001 control fields from the records targeted by this harvester.
32 33 34 |
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 32 def record_ids enumerate_records.lazy.map { |rec| rec.identifier } end |
#records ⇒ Enumerator::Lazy
Returns an enumerator of the records targeted by this harvester.
25 26 27 |
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 25 def records enumerate_records.lazy.map { |rec| build_record(rec) } end |