Class: Relaton::Gb::Hit

Inherits:
Core::Hit
  • Object
show all
Defined in:
lib/relaton/gb/hit.rb

Overview

Hit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pid:, docref:, scraper:, **args) ⇒ Hit

Returns a new instance of Hit.

Parameters:

  • pid (String)
  • docref (String)
  • release_date (String)
  • hit_collection (RelatonGb:HitCollection, NilClass)


25
26
27
28
29
30
31
32
# File 'lib/relaton/gb/hit.rb', line 25

def initialize(pid:, docref:, scraper:, **args)
  @pid            = pid
  @docref         = docref
  @scraper        = scraper
  @release_date   = Date.parse args[:release_date] if args[:release_date]
  @status         = args[:status]
  @hit_collection = args[:hit_collection]
end

Instance Attribute Details

#docrefString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/relaton/gb/hit.rb', line 8

def docref
  @docref
end

#pidString (readonly)

Returns:

  • (String)


8
9
10
# File 'lib/relaton/gb/hit.rb', line 8

def pid
  @pid
end

#release_dateDate, NilClass (readonly)

Returns:

  • (Date, NilClass)


11
12
13
# File 'lib/relaton/gb/hit.rb', line 11

def release_date
  @release_date
end

#scraperRelatonGb::GbScraper, ... (readonly)

Returns:

  • (RelatonGb::GbScraper, RelatonGb::SecScraper, RelatonGb::TScraper)


17
18
19
# File 'lib/relaton/gb/hit.rb', line 17

def scraper
  @scraper
end

#statusString, NilClass (readonly)

Returns:

  • (String, NilClass)


14
15
16
# File 'lib/relaton/gb/hit.rb', line 14

def status
  @status
end

Instance Method Details

#inspectString

Returns:

  • (String)


41
42
43
44
45
# File 'lib/relaton/gb/hit.rb', line 41

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

#itemIsobib::IsoBibliographicItem

Parse page.

Returns:

  • (Isobib::IsoBibliographicItem)


36
37
38
# File 'lib/relaton/gb/hit.rb', line 36

def item
  @item ||= scraper.scrape_doc self
end