Class: RelatonCalconnect::XMLParser

Inherits:
RelatonBib::XMLParser
  • Object
show all
Defined in:
lib/relaton_calconnect/xml_parser.rb

Class Method Summary collapse

Class Method Details

.bib_item(item_hash) ⇒ RelatonCalconnect::CcBibliographicItem

override RelatonBib::BibliographicItem.bib_item method

Parameters:

  • item_hash (Hash)

Returns:



7
8
9
# File 'lib/relaton_calconnect/xml_parser.rb', line 7

def bib_item(item_hash)
  CcBibliographicItem.new(**item_hash)
end

.create_doctype(type) ⇒ Object



24
25
26
# File 'lib/relaton_calconnect/xml_parser.rb', line 24

def create_doctype(type)
  DocumentType.new type: type.text, abbreviation: type[:abbreviation]
end

.fetch_editorialgroup(ext) ⇒ RelatonBib::EditorialGroup?

Parameters:

  • ext (Nokogiri::XML::Element)

Returns:

  • (RelatonBib::EditorialGroup, nil)


13
14
15
16
17
18
19
20
21
22
# File 'lib/relaton_calconnect/xml_parser.rb', line 13

def fetch_editorialgroup(ext)
  return unless ext && (eg = ext.at "editorialgroup")

  eg = eg.xpath("committee", "technical-committee").map do |tc|
    wg = RelatonBib::WorkGroup.new(name: tc.text, number: tc[:number]&.to_i,
                                   type: tc[:type])
    TechnicalCommittee.new wg
  end
  RelatonBib::EditorialGroup.new eg if eg.any?
end