class RelatonGb::XMLParser

Private Class Methods

bib_item(item_hash) click to toggle source

override RelatonBib::BibliographicItem.bib_item method @param item_hash [Hash] @return [RelatonGb::GbBibliographicItem]

# File lib/relaton_gb/xml_parser.rb, line 11
def bib_item(item_hash)
  GbBibliographicItem.new **item_hash
end
fetch_ccs(doc) click to toggle source
# File lib/relaton_gb/xml_parser.rb, line 31
def fetch_ccs(doc)
  doc.xpath("./ext/ccs/code").map &:text
end
fetch_committee(doc) click to toggle source
# File lib/relaton_gb/xml_parser.rb, line 24
def fetch_committee(doc)
  committee = doc.at "./ext/gbcommittee"
  return nil unless committee

  { type: committee[:type], name: committee.text }
end
fetch_gbtype(doc) click to toggle source
# File lib/relaton_gb/xml_parser.rb, line 35
def fetch_gbtype(doc)
  gbtype = doc.at "./ext/gbtype"
  {
    scope: gbtype&.at("gbscope")&.text,
    prefix: gbtype&.at("gbprefix")&.text,
    mandate: gbtype&.at("gbmandate")&.text,
    topic: gbtype&.at("gbtopic")&.text,
  }
end
item_data(gbitem) click to toggle source
Calls superclass method
# File lib/relaton_gb/xml_parser.rb, line 15
def item_data(gbitem)
  data = super
  data[:committee] = fetch_committee gbitem
  data[:gbtype] = fetch_gbtype gbitem
  data[:ccs] = fetch_ccs gbitem
  data[:plannumber] = gbitem.at("./plannumber")&.text
  data
end