Sha256: 5741ca5d3372227dad8b04a0e6bc233c28bb86155482d9aa7d23bc044cde95ab

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 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)
      end
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
anemone-0.0.1 lib/anemone/tentacle.rb
anemone-0.0.2 lib/anemone/tentacle.rb