Class: Scruber::QueueAdapters::Memory::Page

Inherits:
AbstractAdapter::Page show all
Defined in:
lib/scruber/queue_adapters/memory.rb

Overview

Queue item class

Author:

  • Ivan Goncharov

Instance Attribute Summary

Attributes inherited from AbstractAdapter::Page

#body, #enqueued_at, #fetched_at, #fetcher_agent_id, #headers, #id, #max_retry_times, #method, #options, #page_type, #priority, #processed_at, #proxy_id, #queue, #response_body, #response_code, #response_headers, #response_total_time, #retry_at, #retry_count, #url, #user_agent

Instance Method Summary collapse

Methods inherited from AbstractAdapter::Page

#[], #fetcher_agent, #initialize, #processed!, #proxy, #redownload!, #response_cookies, #sent_to_redownload?, #url_join

Constructor Details

This class inherits a constructor from Scruber::QueueAdapters::AbstractAdapter::Page

Instance Method Details

#deletevoid

This method returns an undefined value.

Delete page from all queues



48
49
50
# File 'lib/scruber/queue_adapters/memory.rb', line 48

def delete
  @queue.delete self
end

#savevoid

This method returns an undefined value.

Save page

Depends on page attributes it push page to pending, downloaded or error queue.



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/scruber/queue_adapters/memory.rb', line 32

def save
  if self.processed_at.to_i > 0
    @queue.add_processed_page self
  elsif self.fetched_at > 0
    @queue.add_downloaded self
  elsif self.max_retry_times && self.retry_count >= self.max_retry_times.to_i
    @queue.add_error_page self
  else
    @queue.add self
  end
end