Sha256: eedf24a671d06bf47c0b8a99fdfd79a1948b2f7b20adab652b6b86640268fffe

Contents?: true

Size: 1.38 KB

Versions: 6

Compression:

Stored size: 1.38 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: RelatonBib.array(eg[:technical_committee]),
          subcommittee: RelatonBib.array(eg[:subcommittee]),
          workgroup: RelatonBib.array(eg[:workgroup]),
          secretariat: eg[:secretariat],
        )
      end

      # @param ret [Hash]
      def ics_hash_to_bib(ret)
        ret[:ics] = RelatonBib.array(ret[:ics]).map do |ics|
          Ics.new(ics[:code] || 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

6 entries across 6 versions & 1 rubygems

Version Path
relaton-iso-bib-1.16.2 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.16.1 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.16.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.14.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.13.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.12.1 lib/relaton_iso_bib/hash_converter.rb