Sha256: 0f278d07c06557d449c617f7f81b6d2574c0e9b8d3c5dcb07cfed830ded06a64

Contents?: true

Size: 814 Bytes

Versions: 7

Compression:

Stored size: 814 Bytes

Contents

module RelatonGb
  module HashConverter
    include RelatonIsoBib::HashConverter
    extend self

    # @override RelatonBib::HashConverter.hash_to_bib
    # @param args [Hash]
    # @param nested [TrueClass, FalseClass]
    # @return [Hash]
    def hash_to_bib(args)
      ret = super
      return if ret.nil?

      ccs_hash_to_bib(ret)
      ret
    end

    private

    #
    # Ovverides superclass's method
    #
    # @param item [Hash]
    # @retirn [RelatonGb::GbBibliographicItem]
    def bib_item(item)
      GbBibliographicItem.new(item)
    end

    def ccs_hash_to_bib(ret)
      ret[:ccs] = RelatonBib.array(ret[:ccs]).map do |ccs|
        (ccs[:code] && Cnccs.fetch(ccs[:code])) || Cnccs.fetch(ccs)
      end
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
relaton-gb-1.19.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.18.4 lib/relaton_gb/hash_converter.rb
relaton-gb-1.18.3 lib/relaton_gb/hash_converter.rb
relaton-gb-1.18.2 lib/relaton_gb/hash_converter.rb
relaton-gb-1.18.1 lib/relaton_gb/hash_converter.rb
relaton-gb-1.18.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.17.0 lib/relaton_gb/hash_converter.rb