Sha256: f2ef48305406fe4a13daf30b3a1c4a1448e2afa5cb4f5fb0c8e11f031ab6e792

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

module Retriever
  #
  class PageIterator < Fetch
    # recieves target url and RR options, and a block
    # runs the block on all pages during crawl, pushing
    #   the returned value of the block onto a result stack
    #   the complete data returned from the crawl is accessible thru self.result
    def initialize(url, options, &block)
      super
      start
      fail 'block required for PageIterator' unless block_given?
      @iterator = true
      @result.push(block.call @page_one)
      lg("-- PageIterator crawled- #{url}")
      async_crawl_and_collect(&block)
      # done, make sure progress bar says we are done
      @progressbar.finish if @progress
      @result.sort_by! { |x| x.length } if @result.size > 1
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyretriever-1.3.0 lib/retriever/page_iterator.rb