Sha256: 496994216c00b4db87d59d342246154a6f3680824ac4f2834a440c0b6f23243f

Contents?: true

Size: 972 Bytes

Versions: 3

Compression:

Stored size: 972 Bytes

Contents

module RelatonCalconnect
  class XMLParser < RelatonBib::XMLParser
    class << self
      # override RelatonBib::BibliographicItem.bib_item method
      # @param item_hash [Hash]
      # @return [RelatonCalconnect::CcBibliographicItem]
      def bib_item(item_hash)
        CcBibliographicItem.new(**item_hash)
      end

      # @param ext [Nokogiri::XML::Element]
      # @return [RelatonBib::EditorialGroup, nil]
      def fetch_editorialgroup(ext)
        return unless ext && (eg = ext.at "editorialgroup")

        eg = eg.xpath("committee", "technical-committee").map do |tc|
          wg = RelatonBib::WorkGroup.new(name: tc.text, number: tc[:number]&.to_i,
                                         type: tc[:type])
          TechnicalCommittee.new wg
        end
        RelatonBib::EditorialGroup.new eg if eg.any?
      end

      def create_doctype(type)
        DocumentType.new type: type.text, abbreviation: type[:abbreviation]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
relaton-calconnect-1.20.0 lib/relaton_calconnect/xml_parser.rb
relaton-calconnect-1.19.1 lib/relaton_calconnect/xml_parser.rb
relaton-calconnect-1.19.0 lib/relaton_calconnect/xml_parser.rb