Class: RelatonGb::Hit

Inherits:
RelatonBib::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:, scrapper:, **args) ⇒ Hit

Returns a new instance of Hit.

Parameters:

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


24
25
26
27
28
29
30
31
# File 'lib/relaton_gb/hit.rb', line 24

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

Instance Attribute Details

#docrefString (readonly)

Returns:

  • (String)


7
8
9
# File 'lib/relaton_gb/hit.rb', line 7

def docref
  @docref
end

#pidString (readonly)

Returns:

  • (String)


7
8
9
# File 'lib/relaton_gb/hit.rb', line 7

def pid
  @pid
end

#release_dateDate, NilClass (readonly)

Returns:

  • (Date, NilClass)


10
11
12
# File 'lib/relaton_gb/hit.rb', line 10

def release_date
  @release_date
end

#scrapperRelatonGb::GbScrapper, ... (readonly)

Returns:



16
17
18
# File 'lib/relaton_gb/hit.rb', line 16

def scrapper
  @scrapper
end

#statusString, NilClass (readonly)

Returns:

  • (String, NilClass)


13
14
15
# File 'lib/relaton_gb/hit.rb', line 13

def status
  @status
end

Instance Method Details

#fetchIsobib::IsoBibliographicItem

Parse page.

Returns:

  • (Isobib::IsoBibliographicItem)


35
36
37
# File 'lib/relaton_gb/hit.rb', line 35

def fetch
  @fetch ||= scrapper.scrape_doc self
end

#inspectString

Returns:

  • (String)


40
41
42
43
44
# File 'lib/relaton_gb/hit.rb', line 40

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