Class: Krikri::Harvesters::MarcXMLDoc

Inherits:
Object
  • Object
show all
Defined in:
lib/krikri/harvesters/marc_xml_harvester.rb

Overview

Value object containing a MARC record’s identifier (parsed from control

field 001) and original (MARC XML) source.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nokogiri_doc) ⇒ MarcXMLDoc

Returns a new instance of MarcXMLDoc.

Parameters:

  • nokogiri_doc


87
88
89
90
91
92
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 87

def initialize(nokogiri_doc)
  @source = nokogiri_doc.outer_xml
  doc = Nokogiri::XML(@source)

  @identifier = doc.xpath("//xmlns:controlfield[@tag='001']").text
end

Instance Attribute Details

#identifierObject (readonly)



83
84
85
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 83

def identifier
  @identifier
end

#sourceObject (readonly)

Returns the value of attribute source.



83
# File 'lib/krikri/harvesters/marc_xml_harvester.rb', line 83

attr_reader :identifier, :source