Sha256: e3749ca6cb77987284552e4e4596d0cff7364fe81417c79884a6e04eb80f2736

Contents?: true

Size: 569 Bytes

Versions: 2

Compression:

Stored size: 569 Bytes

Contents

require 'anemone/page'

module Anemone
  class Tentacle
    
    #
    # Create a new Tentacle
    #
    def initialize(link_queue, page_queue)
      @link_queue = link_queue
      @page_queue = page_queue
    end
    
    #
    # Gets links from @link_queue, and returns the fetched
    # Page objects into @page_queue
    #
    def run
      while true do
        link = @link_queue.deq
        
        break if link == :END

        page = Page.fetch(link)
        
        @page_queue.enq(page)

        sleep Anemone.options.delay
      end
    end
    
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
parolkar-anemone-0.1.2 lib/anemone/tentacle.rb
anemone-0.1.2 lib/anemone/tentacle.rb