Class: RelatonGb::Hit

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_gb/hit.rb

Overview

Hit.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pid:, title:, hit_collection: nil, scrapper:) ⇒ Hit



20
21
22
23
24
25
26
# File 'lib/relaton_gb/hit.rb', line 20

def initialize(pid:, title:, hit_collection: nil, scrapper:)
  @pid            = pid
  @title          = title
  @hit_collection = hit_collection
  @scrapper       = scrapper
  self.hit_collection << self if hit_collection
end

Instance Attribute Details

#hit_collectionIsobib::HitCollection (readonly)



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

def hit_collection
  @hit_collection
end

#pidString (readonly)



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

def pid
  @pid
end

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



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

def scrapper
  @scrapper
end

#titleString (readonly)



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

def title
  @title
end

Instance Method Details

#fetchIsobib::IsoBibliographicItem

Parse page.



30
31
32
# File 'lib/relaton_gb/hit.rb', line 30

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

#inspectString



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

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

#to_sString



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

def to_s
  inspect
end