Sha256: d7d327750129ee2b2e812df1d5eff4465c08c5c663d9106a305cd2eee1c86a30

Contents?: true

Size: 623 Bytes

Versions: 6

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

module RelatonIso
  # Hit.
  class Hit < RelatonBib::Hit
    # @return [RelatonIsoBib::IsoBibliographicItem]
    attr_writer :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[:status] # && hit["publicationStatus"]["key"]
      when "Published" then 0
      when "Under development" then 1
      when "Withdrawn" then 2
      when "Deleted" then 3
      else 4
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
relaton-iso-1.11.1 lib/relaton_iso/hit.rb
relaton-iso-1.11.0 lib/relaton_iso/hit.rb
relaton-iso-1.10.1 lib/relaton_iso/hit.rb
relaton-iso-1.10.0 lib/relaton_iso/hit.rb
relaton-iso-1.9.1 lib/relaton_iso/hit.rb
relaton-iso-1.9.0 lib/relaton_iso/hit.rb