Sha256: 4dfba05649577a0dd25ad6e8cea541e4f28d44362820f0642ee2729317fb2cc5

Contents?: true

Size: 1.23 KB

Versions: 50

Compression:

Stored size: 1.23 KB

Contents

module RelatonNist
  class XMLParser < RelatonBib::XMLParser
    class << self
      private

      # @param intem [Nokogiri::XML::Document]
      # @return [Hash]
      def item_data(item)
        data = super
        ext = item.at "./ext"
        return data unless ext

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

      # @param item_hash [Hash]
      # @return [RelatonNist::NistBibliographicItem]
      def bib_item(item_hash)
        NistBibliographicItem.new(**item_hash)
      end

      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

      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

      # @param item [Nokogiri::XML::Element]
      # @return [Array<RelatonBib::DocumentRelation>]
      def fetch_relations(item)
        super item, DocumentRelation
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
relaton-nist-1.20.0 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.7 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.6 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.5 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.4 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.3 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.1 lib/relaton_nist/xml_parser.rb
relaton-nist-1.19.0 lib/relaton_nist/xml_parser.rb
relaton-nist-1.18.0 lib/relaton_nist/xml_parser.rb
relaton-nist-1.17.0 lib/relaton_nist/xml_parser.rb
relaton-nist-1.16.4 lib/relaton_nist/xml_parser.rb
relaton-nist-1.16.3 lib/relaton_nist/xml_parser.rb
relaton-nist-1.16.2 lib/relaton_nist/xml_parser.rb
relaton-nist-1.16.1 lib/relaton_nist/xml_parser.rb
relaton-nist-1.16.0 lib/relaton_nist/xml_parser.rb
relaton-nist-1.14.9 lib/relaton_nist/xml_parser.rb
relaton-nist-1.14.8 lib/relaton_nist/xml_parser.rb
relaton-nist-1.14.7 lib/relaton_nist/xml_parser.rb
relaton-nist-1.14.6 lib/relaton_nist/xml_parser.rb
relaton-nist-1.14.5 lib/relaton_nist/xml_parser.rb