Sha256: 36fcb1c939497cfe5411f14fc09c9652642915ceebe28e7bf70b9874aba84207

Contents?: true

Size: 1.35 KB

Versions: 5

Compression:

Stored size: 1.35 KB

Contents

module RelatonIsoBib
  class HashConverter < RelatonBib::HashConverter
    class << self
      private

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

      #
      # Ovverides superclass's method
      #
      # @param title [Hash]
      # @return [RelatonBib::TypedTitleString]
      def typed_title_strig(title)
        RelatonBib::TypedTitleString.new(**title)
      end

      # @param ret [Hash]
      def editorialgroup_hash_to_bib(ret)
        eg = ret[:editorialgroup]
        return unless eg

        ret[:editorialgroup] = EditorialGroup.new(
          technical_committee: array(eg[:technical_committee]),
          subcommittee: array(eg[:subcommittee]),
          workgroup: array(eg[:workgroup]),
          secretariat: eg[:secretariat],
        )
      end

      # @param ret [Hash]
      def ics_hash_to_bib(ret)
        ret[:ics] = array(ret[:ics]).map do |ics|
          ics[:code] ? Ics.new(ics[:code]) : Ics.new(ics)
        end
      end

      # @param ret [Hash]
      def structuredidentifier_hash_to_bib(ret)
        return unless ret[:structuredidentifier]

        ret[:structuredidentifier] = RelatonIsoBib::StructuredIdentifier.new(**ret[:structuredidentifier])
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
relaton-iso-bib-1.12.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.11.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.10.1 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.10.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.9.0 lib/relaton_iso_bib/hash_converter.rb