Class: RelatonGb::Hit
- Inherits:
-
Object
- Object
- RelatonGb::Hit
- Defined in:
- lib/relaton_gb/hit.rb
Overview
Hit.
Instance Attribute Summary collapse
- #hit_collection ⇒ Isobib::HitCollection readonly
- #pid ⇒ String readonly
- #scrapper ⇒ RelatonGb::GbScrapper, ... readonly
- #title ⇒ String readonly
Instance Method Summary collapse
-
#fetch ⇒ Isobib::IsoBibliographicItem
Parse page.
-
#initialize(pid:, title:, hit_collection: nil, scrapper:) ⇒ Hit
constructor
A new instance of Hit.
- #inspect ⇒ String
- #to_s ⇒ String
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_collection ⇒ Isobib::HitCollection (readonly)
7 8 9 |
# File 'lib/relaton_gb/hit.rb', line 7 def hit_collection @hit_collection end |
#pid ⇒ String (readonly)
10 11 12 |
# File 'lib/relaton_gb/hit.rb', line 10 def pid @pid end |
#scrapper ⇒ RelatonGb::GbScrapper, ... (readonly)
16 17 18 |
# File 'lib/relaton_gb/hit.rb', line 16 def scrapper @scrapper end |
#title ⇒ String (readonly)
13 14 15 |
# File 'lib/relaton_gb/hit.rb', line 13 def title @title end |
Instance Method Details
#fetch ⇒ Isobib::IsoBibliographicItem
Parse page.
30 31 32 |
# File 'lib/relaton_gb/hit.rb', line 30 def fetch @fetch ||= scrapper.scrape_doc pid end |
#inspect ⇒ String
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_s ⇒ String
35 36 37 |
# File 'lib/relaton_gb/hit.rb', line 35 def to_s inspect end |