class RelatonNist::XMLParser

Private Class Methods

bib_item(item_hash) click to toggle source

@param item_hash [Hash] @return [RelatonNist::NistBibliographicItem]

# File lib/relaton_nist/xml_parser.rb, line 19
def bib_item(item_hash)
  NistBibliographicItem.new(**item_hash)
end
fetch_commentperiod(item) click to toggle source
# File lib/relaton_nist/xml_parser.rb, line 34
def fetch_commentperiod(item)
  cp = item.at "./commentperiod"
  return unless cp

  CommentPeriod.new(
    from: cp.at("from").text, to: cp.at("to")&.text,
    extended: cp.at("extended")&.text
  )
end
fetch_relations(item) click to toggle source

@param item [Nokogiri::XML::Element] @return [Array<RelatonBib::DocumentRelation>]

Calls superclass method
# File lib/relaton_nist/xml_parser.rb, line 46
def fetch_relations(item)
  super item, DocumentRelation
end
fetch_status(item) click to toggle source
# File lib/relaton_nist/xml_parser.rb, line 23
def fetch_status(item)
  status = item.at "./status"
  return unless status

  DocumentStatus.new(
    stage: status.at("stage")&.text,
    substage: status.at("substage")&.text,
    iteration: status.at("iteration")&.text,
  )
end
item_data(item) click to toggle source

@param intem [Nokogiri::XML::Document] @return [Hash]

Calls superclass method
# File lib/relaton_nist/xml_parser.rb, line 8
def item_data(item)
  data = super
  ext = item.at "./ext"
  return data unless ext

  data[:commentperiod] = fetch_commentperiod(ext)
  data
end