Sha256: 3ddb87def4e4d57a1f0e3272eaab8bedeb0960f01194635d5ccad39c82d88d4d

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module RelatonIso
  # Hit.
  class Hit < RelatonBib::Hit
    # @return [RelatonIsoBib::IsoBibliographicItem]
    attr_accessor :fetch

    # Parse page.
    # @param lang [String, NilClass]
    # @return [RelatonIso::IsoBibliographicItem]
    def fetch(lang = nil)
      @fetch ||= Scrapper.parse_page @hit, lang
    end

    # @return [Integer]
    def sort_weight
      case hit["publicationStatus"] && hit["publicationStatus"]["key"]
      when "ENT_ACTIVE" then 0
      when "ENT_PROGRESS" then 1
      when "ENT_INACTIVE" then 2
      else 3
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
relaton-iso-1.8.0 lib/relaton_iso/hit.rb
relaton-iso-1.7.5 lib/relaton_iso/hit.rb