class RelatonUn::XMLParser
Private Class Methods
bib_item(item_hash)
click to toggle source
@param item_hash [Hash] @return [RelatonBib::BibliographicItem]
# File lib/relaton_un/xml_parser.rb, line 8 def bib_item(item_hash) UnBibliographicItem.new(**item_hash) end
fetch_editorialgroup(ext)
click to toggle source
@param ext [Nokogiri::XML::Element] @return [RelatonUn::EditorialGroup]
# File lib/relaton_un/xml_parser.rb, line 47 def fetch_editorialgroup(ext) eg = ext.at("./editorialgroup") return unless eg committee = eg.xpath("committee").map &:text EditorialGroup.new committee end
fetch_session(ext)
click to toggle source
@param ext [Nokogiri::XML::Element] @return [RelatonUn::Session]
# File lib/relaton_un/xml_parser.rb, line 30 def fetch_session(ext) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity session = ext.at "./session" RelatonUn::Session.new( session_number: session.at("number")&.text, session_date: session.at("session-date")&.text, item_number: session.xpath("item-number").map(&:text), item_name: session.xpath("item-name").map(&:text), subitem_name: session.xpath("subitem-name").map(&:text), collaborator: session.at("collaborator")&.text, agenda_id: session.at("agenda-id")&.text, item_footnote: session.at("item-footnote")&.text, ) end
fetch_submissionlanguage(ext)
click to toggle source
@param ext [Nokogiri::XML::Element] @return [Array<String>]
# File lib/relaton_un/xml_parser.rb, line 57 def fetch_submissionlanguage(ext) ext.xpath("./submissionlanguage").map(&:text) end
item_data(item)
click to toggle source
@param item [Nokogiri::XML::Element] @return [Hash]
Calls superclass method
# File lib/relaton_un/xml_parser.rb, line 14 def item_data(item) data = super ext = item.at "./ext" return data unless ext data[:submissionlanguage] = fetch_submissionlanguage ext data[:session] = fetch_session ext data[:distribution] = ext.at("distribution")&.text data[:job_number] = ext.at("job_number")&.text data end