Sha256: e64290f32bac606443eca7f84ed579b2cecc5f02593f5bf7b5d2f2f67b1bb7a0

Contents?: true

Size: 1.92 KB

Versions: 28

Compression:

Stored size: 1.92 KB

Contents

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

      #
      # Parse XML to hash
      #
      # @param [Nokofiri::XML::Element] bibitem
      #
      # @return [Hash]
      #
      def item_data(bibitem)
        hash = super
        ext = bibitem.at "./ext"
        if ext
          hash[:radiotechnology] = ext.at("./radiotechnology")&.text
          hash[:common_ims_spec] = ext.at("./common-ims-spec")&.text
          hash[:release] = fetch_release(ext)
        end
        hash
      end

      #
      # Ftech release information
      #
      # @param [Nokogiri::XML::Element] ext
      #
      # @return [Relaton3gpp::Release] release
      #
      def fetch_release(ext) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
        release = ext.at("./release")
        return unless release

        hash = {}
        hash[:version2g] = release.at("./version2G")&.text
        hash[:version3g] = release.at("./version3G")&.text
        hash[:defunct] = release.at("./defunct")&.text
        hash[:wpm_code_2g] = release.at("./wpm-code-2G")&.text
        hash[:wpm_code_3g] = release.at("./wpm-code-3G")&.text
        hash[:freeze_meeting] = release.at("./freeze-meeting")&.text
        hash[:freeze_stage1_meeting] = release.at("./freeze-stage1-meeting")&.text
        hash[:freeze_stage2_meeting] = release.at("./freeze-stage2-meeting")&.text
        hash[:freeze_stage3_meeting] = release.at("./freeze-stage3-meeting")&.text
        hash[:close_meeting] = release.at("./close-meeting")&.text
        hash[:project_start] = release.at("./project-start")&.text
        hash[:project_end] = release.at("./project-end")&.text
        Release.new(**hash)
      end

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

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
relaton-3gpp-1.18.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.17.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.16.3 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.16.2 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.16.1 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.16.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.6 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.5 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.4 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.3 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.2 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.1 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.14.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.13.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.12.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.11.1 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.11.0 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.10.5 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.10.4 lib/relaton_3gpp/xml_parser.rb
relaton-3gpp-1.10.3 lib/relaton_3gpp/xml_parser.rb