class RelatonIho::XMLParser
Private Class Methods
bib_item(item_hash)
click to toggle source
@param item_hash [Hash] @return [RelatonIho::IhoBibliographicItem]
# File lib/relaton_iho/xml_parser.rb, line 20 def bib_item(item_hash) IhoBibliographicItem.new **item_hash end
fetch_commentperiond(ext)
click to toggle source
@param ext [Nokogiri::XML::Element] @return [RelatonIho::CommentPeriod, nil]
# File lib/relaton_iho/xml_parser.rb, line 51 def fetch_commentperiond(ext) return unless ext && (cp = ext.at "commentperiod") CommentPeriond.new from: cp.at("from")&.text, to: cp.at("to")&.text end
fetch_editorialgroup(ext)
click to toggle source
@param ext [Nokogiri::XML::Element, nil] @return [RelatonIho::EditorialGroupCollection, nil]
# File lib/relaton_iho/xml_parser.rb, line 26 def fetch_editorialgroup(ext) return unless ext egs = ext.xpath("editorialgroup").map do |eg| grps = eg.xpath("committee|workgroup|commission").map do |ig| iho_group ig end EditorialGroup.new grps end EditorialGroupCollection.new egs if egs.any? end
iho_group(ihgrp)
click to toggle source
@param ihgrp [Nokogiri::XML::Element, nil] @return [RelatonIho::Committee, RelatonIho::Commission
,
RelatonIho::Workgroup, nil]
# File lib/relaton_iho/xml_parser.rb, line 41 def iho_group(ihgrp) return unless ihgrp klass = Object.const_get "RelatonIho::" + ihgrp.name.capitalize subg = iho_group ihgrp.at("./committee|./workgroup|./commission") klass.new ihgrp.at("abbreviation").text, ihgrp.at("name")&.text, subg end
item_data(item)
click to toggle source
Override RelatonBib::XMLParser.item_data method. @param item [Nokogiri::XML::Element] @returtn [Hash]
Calls superclass method
# File lib/relaton_iho/xml_parser.rb, line 9 def item_data(item) data = super ext = item.at "./ext" return data unless ext data[:commentperiod] = fetch_commentperiond ext data end