Sha256: 7d2ca9923e6fc28edcc70922ddd34f8f84a73e8ac0262086d4dfcb08ce0503d9

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

module RelatonIeee
  module HashConverter
    include RelatonBib::HashConverter
    extend 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

    def create_doctype(**args)
      DocumentType.new(**args)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
relaton-ieee-1.19.1 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.19.0 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.18.0 lib/relaton_ieee/hash_converter.rb
relaton-ieee-1.17.0 lib/relaton_ieee/hash_converter.rb