Sha256: 8bf80273db5e058b314aef2827a88ca2583cde0565ef6423649273897e6fa5f7

Contents?: true

Size: 1.35 KB

Versions: 3

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

3 entries across 3 versions & 1 rubygems

Version Path
relaton-iso-bib-1.8.1 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.8.0 lib/relaton_iso_bib/hash_converter.rb
relaton-iso-bib-1.7.1 lib/relaton_iso_bib/hash_converter.rb