Class: RelatonGb::HitCollection
- Inherits:
-
Array
- Object
- Array
- RelatonGb::HitCollection
- Defined in:
- lib/relaton_gb/hit_collection.rb
Overview
Page of hit collection
Instance Attribute Summary collapse
- #fetched ⇒ TrueClass, FalseClass readonly
- #hit_pages ⇒ Isobib::HitPages readonly
- #scrapper ⇒ RelatonGb::GbScrapper, ... readonly
Instance Method Summary collapse
-
#initialize(hits = [], hit_pages = nil) ⇒ HitCollection
constructor
A new instance of HitCollection.
- #inspect ⇒ Object
-
#to_s ⇒ RelatonGb::HitCollection
def fetch workers = RelatonBib::WorkersPool.new 4 workers.worker(&:fetch) each do |hit| workers << hit end workers.end workers.result @fetched = true self end.
Constructor Details
#initialize(hits = [], hit_pages = nil) ⇒ HitCollection
Returns a new instance of HitCollection.
18 19 20 21 22 |
# File 'lib/relaton_gb/hit_collection.rb', line 18 def initialize(hits = [], hit_pages = nil) concat hits @fetched = false @hit_pages = hit_pages end |
Instance Attribute Details
#fetched ⇒ TrueClass, FalseClass (readonly)
7 8 9 |
# File 'lib/relaton_gb/hit_collection.rb', line 7 def fetched @fetched end |
#hit_pages ⇒ Isobib::HitPages (readonly)
10 11 12 |
# File 'lib/relaton_gb/hit_collection.rb', line 10 def hit_pages @hit_pages end |
#scrapper ⇒ RelatonGb::GbScrapper, ... (readonly)
13 14 15 |
# File 'lib/relaton_gb/hit_collection.rb', line 13 def scrapper @scrapper end |
Instance Method Details
#inspect ⇒ Object
41 42 43 |
# File 'lib/relaton_gb/hit_collection.rb', line 41 def inspect "<#{self.class}:#{format('%#.14x', object_id << 1)} @fetched=#{@fetched}>" end |
#to_s ⇒ RelatonGb::HitCollection
def fetch
workers = RelatonBib::WorkersPool.new 4
workers.worker(&:fetch)
each do |hit|
workers << hit
end
workers.end
workers.result
@fetched = true
self
end
37 38 39 |
# File 'lib/relaton_gb/hit_collection.rb', line 37 def to_s inspect end |