Class: Relaton::Core::Hit
- Inherits:
-
Object
- Object
- Relaton::Core::Hit
- Defined in:
- lib/relaton/core/hit.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
- #fetched? ⇒ Boolean
-
#initialize(hit, hit_collection = nil) ⇒ Hit
constructor
A new instance of Hit.
- #inspect ⇒ String
- #item ⇒ RelatonBib::ItemData
- #to_s ⇒ String
Constructor Details
#initialize(hit, hit_collection = nil) ⇒ Hit
Returns a new instance of Hit.
14 15 16 17 |
# File 'lib/relaton/core/hit.rb', line 14 def initialize(hit, hit_collection = nil) @hit = hit @hit_collection = WeakRef.new hit_collection if hit_collection end |
Instance Attribute Details
#hit ⇒ Array<Hash> (readonly)
10 11 12 |
# File 'lib/relaton/core/hit.rb', line 10 def hit @hit end |
#hit_collection ⇒ RelatonBib::HitCollection
7 8 9 |
# File 'lib/relaton/core/hit.rb', line 7 def hit_collection @hit_collection end |
Instance Method Details
#fetched? ⇒ Boolean
37 38 39 |
# File 'lib/relaton/core/hit.rb', line 37 def fetched? !@item.nil? end |
#inspect ⇒ String
25 26 27 28 29 30 |
# File 'lib/relaton/core/hit.rb', line 25 def inspect "<#{self.class}:#{format('%<id>#.14x', id: object_id << 1)} " \ "@reference=\"#{@hit_collection&.ref}\" " \ "@fetched=\"#{fetched?}\" " \ "@docidentifier=\"#{@hit[:code]}\">" end |
#item ⇒ RelatonBib::ItemData
33 34 35 |
# File 'lib/relaton/core/hit.rb', line 33 def item raise "Not implemented" end |
#to_s ⇒ String
20 21 22 |
# File 'lib/relaton/core/hit.rb', line 20 def to_s inspect end |