Sha256: c5a554e54e5caf6377207b1bd7c89035e4818344cc61822ec2b8809a920e9553

Contents?: true

Size: 1.29 KB

Versions: 20

Compression:

Stored size: 1.29 KB

Contents

module RelatonNist
  class HashConverter < RelatonBib::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?

        commentperiod_hash_to_bib(ret)
        ret
      end

      private

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

      def commentperiod_hash_to_bib(ret)
        return unless ret[:commentperiod]

        ret[:commentperiod] = CommentPeriod.new **ret[:commentperiod]
      end

      # @param ret [Hash]
      def relations_hash_to_bib(ret)
        super
        return unless ret[:relation]

        ret[:relation] = ret[:relation].map { |r| DocumentRelation.new **r }

        # ret[:relation] = array(ret[:relation])
        # ret[:relation]&.each do |r|
        #   if r[:description]
        #     r[:description] = FormattedString.new r[:description]
        #   end
        #   relation_bibitem_hash_to_bib(r)
        #   relation_locality_hash_to_bib(r)
        #   relation_source_locality_hash_to_bib(r)
        # end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
relaton-nist-1.11.4 lib/relaton_nist/hash_converter.rb
relaton-nist-1.11.3 lib/relaton_nist/hash_converter.rb
relaton-nist-1.11.2 lib/relaton_nist/hash_converter.rb
relaton-nist-1.11.1 lib/relaton_nist/hash_converter.rb
relaton-nist-1.11.0 lib/relaton_nist/hash_converter.rb
relaton-nist-1.10.2 lib/relaton_nist/hash_converter.rb
relaton-nist-1.10.1 lib/relaton_nist/hash_converter.rb
relaton-nist-1.10.0 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.9 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.8 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.7 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.6 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.4 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.3 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.2 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.1 lib/relaton_nist/hash_converter.rb
relaton-nist-1.9.0 lib/relaton_nist/hash_converter.rb
relaton-nist-1.8.0 lib/relaton_nist/hash_converter.rb
relaton-nist-1.7.4 lib/relaton_nist/hash_converter.rb
relaton-nist-1.7.3 lib/relaton_nist/hash_converter.rb