Class: Medusa::Tentacle
- Inherits:
-
Object
- Object
- Medusa::Tentacle
- Defined in:
- lib/medusa/tentacle.rb
Instance Method Summary collapse
-
#initialize(link_queue, page_queue, opts = {}) ⇒ Tentacle
constructor
Create a new Tentacle.
-
#run ⇒ Object
Gets links from @link_queue, and returns the fetched Page objects into @page_queue.
Constructor Details
Instance Method Details
#run ⇒ Object
Gets links from @link_queue, and returns the fetched Page objects into @page_queue
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/medusa/tentacle.rb', line 20 def run loop do link, referer, depth = @link_queue.deq break if link == :END @http.fetch_pages(link, referer, depth).each { |page| @page_queue << page } delay end end |