Sha256: db897f1735bdcfb71407c9312b08b0286f84f38b48ec7554b59928261ed0ab5d

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

module RelatonIeee
  class HashConverter < RelatonBib::HashConverter
    class << self
      # @param args [Hash]
      # @param neated [TrueClas, FalseClass] default true
      # @return [Hash]
      def hash_to_bib(args)
        hash = super
        return unless hash.is_a?(Hash)

        # editorialgroup_hash_to_bib hash
        ext_hash_to_bib hash
        hash
      end

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

      # @param hash [Hash]
      def editorialgroup_hash_to_bib(hash)
        return unless hash[:editorialgroup]

        hash[:editorialgroup] = EditorialGroup.new(**hash[:editorialgroup])
      end

      def ext_hash_to_bib(hash)
        ext = hash.delete(:ext)
        return unless ext

        attrs = %i[standard_status standard_modified pubstatus holdstatus]
        ext.select { |k, _| attrs.include? k }.each do |k, v|
          hash[k] = v
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
relaton-ieee-1.16.3 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.16.2 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.16.1 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.16.0 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.14.8 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.14.7 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.14.6 lib/relaton_ieee/hash_converter.rb