Sha256: bc62813eae895f0153671764e91d37da7e46dc2ea3d9c6c95ed40aeb254ec1af

Contents?: true

Size: 1.28 KB

Versions: 15

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module RelatonGb
  # Hit.
  class Hit < RelatonBib::Hit
    # @return [String]
    attr_reader :pid, :docref

    # @return [Date, NilClass]
    attr_reader :release_date

    # @return [String, NilClass]
    attr_reader :status

    # @return [RelatonGb::GbScrapper, RelatonGb::SecScraper, RelatonGb::TScrapper]
    attr_reader :scrapper

    # @param pid [String]
    # @param docref [String]
    # @parma scrapper [RelatonGb::GbScrapper, RelatonGb::SecScraper, RelatonGb::TScrapper]
    # @param release_date [String]
    # @status [String, NilClass]
    # @param hit_collection [RelatonGb:HitCollection, NilClass]
    def initialize(pid:, docref:, scrapper:, **args)
      @pid            = pid
      @docref         = docref
      @scrapper       = scrapper
      @release_date   = Date.parse args[:release_date] if args[:release_date]
      @status         = args[:status]
      @hit_collection = args[:hit_collection]
    end

    # Parse page.
    # @return [Isobib::IsoBibliographicItem]
    def fetch
      @fetch ||= scrapper.scrape_doc self
    end

    # @return [String]
    def inspect
      "<#{self.class}:#{format('%<id>#.14x', id: object_id << 1)} " \
        "@fullIdentifier=\"#{@fetch&.shortref}\" " \
        "@docref=\"#{docref}\">"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
relaton-gb-1.20.0 lib/relaton_gb/hit.rb
relaton-gb-1.19.0 lib/relaton_gb/hit.rb
relaton-gb-1.18.4 lib/relaton_gb/hit.rb
relaton-gb-1.18.3 lib/relaton_gb/hit.rb
relaton-gb-1.18.2 lib/relaton_gb/hit.rb
relaton-gb-1.18.1 lib/relaton_gb/hit.rb
relaton-gb-1.18.0 lib/relaton_gb/hit.rb
relaton-gb-1.17.0 lib/relaton_gb/hit.rb
relaton-gb-1.16.3 lib/relaton_gb/hit.rb
relaton-gb-1.16.2 lib/relaton_gb/hit.rb
relaton-gb-1.16.1 lib/relaton_gb/hit.rb
relaton-gb-1.16.0 lib/relaton_gb/hit.rb
relaton-gb-1.14.0 lib/relaton_gb/hit.rb
relaton-gb-1.13.0 lib/relaton_gb/hit.rb
relaton-gb-1.12.1 lib/relaton_gb/hit.rb