Sha256: bd21df4b0fa1952a04450ab021ec614d07716b08aa7a1bb12f48cb58671b815f

Contents?: true

Size: 806 Bytes

Versions: 18

Compression:

Stored size: 806 Bytes

Contents

require "yaml"

module RelatonGb
  class HashConverter < RelatonIsoBib::HashConverter
    class << self
      # @override RelatonBib::HashConverter.hash_to_bib
      # @param args [Hash]
      # @param nested [TrueClass, FalseClass]
      # @return [Hash]
      def hash_to_bib(args, nested = false)
        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] = array(ret[:ccs]).map do |ccs|
          ccs[:code] ? Cnccs.fetch(ccs[:code]) : Cnccs.fetch(ccs)
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
relaton-gb-1.11.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.10.1 lib/relaton_gb/hash_converter.rb
relaton-gb-1.10.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.9.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.8.1 lib/relaton_gb/hash_converter.rb
relaton-gb-1.8.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.7.2 lib/relaton_gb/hash_converter.rb
relaton-gb-1.7.1 lib/relaton_gb/hash_converter.rb
relaton-gb-1.7.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.6.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.6.pre1 lib/relaton_gb/hash_converter.rb
relaton-gb-1.5.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.5.pre lib/relaton_gb/hash_converter.rb
relaton-gb-1.4.0 lib/relaton_gb/hash_converter.rb
relaton-gb-1.3.0 lib/relaton_gb/hash_converter.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/relaton-gb-1.2.0/lib/relaton_gb/hash_converter.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/relaton-gb-1.2.0/lib/relaton_gb/hash_converter.rb
relaton-gb-1.2.0 lib/relaton_gb/hash_converter.rb