Sha256: 9062abca2bff51ff534fa19beca1fa87aec6f3511ac8d05952866d006c84f780

Contents?: true

Size: 1.04 KB

Versions: 18

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module RelatonGb
  # Page of hit collection
  class HitCollection < Array
    # @return [TrueClass, FalseClass]
    attr_reader :fetched

    # @return [Isobib::HitPages]
    attr_reader :hit_pages

    # @return [RelatonGb::GbScrapper, RelatonGb::SecScrapper, RelatonGb::TScrapper]
    attr_reader :scrapper

    # @param hits [Array<Hash>]
    # @param hit_pages [Integer]
    # @param scrapper [RelatonGb::GbScrapper, RelatonGb::SecScrapper, RelatonGb::TScrapper]
    def initialize(hits = [], hit_pages = nil)
      concat hits
      @fetched   = false
      @hit_pages = hit_pages
    end

    # @return [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

    def to_s
      inspect
    end

    def inspect
      "<#{self.class}:#{format('%#.14x', object_id << 1)} @fetched=#{@fetched}>"
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
relaton-gb-0.10.0 lib/relaton_gb/hit_collection.rb
relaton-gb-0.9.0 lib/relaton_gb/hit_collection.rb
relaton-gb-0.8.0 lib/relaton_gb/hit_collection.rb
relaton-gb-0.7.1 lib/relaton_gb/hit_collection.rb
relaton-gb-0.7.0 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.8 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.7 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.6 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.5 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.4 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.3 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.2 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.1 lib/relaton_gb/hit_collection.rb
relaton-gb-0.6.0 lib/relaton_gb/hit_collection.rb
relaton-gb-0.5.2 lib/relaton_gb/hit_collection.rb
relaton-gb-0.5.1 lib/relaton_gb/hit_collection.rb
relaton-gb-0.5.0 lib/relaton_gb/hit_collection.rb
relaton-gb-0.1.0 lib/relaton_gb/hit_collection.rb