Class: Scruber::QueueAdapters::AbstractAdapter Abstract
- Defined in:
- lib/scruber/queue_adapters/abstract_adapter.rb
Overview
Abstract Queue Adapter
Direct Known Subclasses
Defined Under Namespace
Classes: Page
Instance Method Summary collapse
-
#add(url, options = {}) ⇒ void
Add page to queue.
-
#downloaded_count ⇒ Integer
Count of downloaded pages Using to show downloading progress.
-
#fetch_downloaded(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch downloaded and not processed pages for feching.
-
#fetch_error(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch error page.
-
#fetch_pending(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch pending page for fetching.
-
#find(id) ⇒ Page
Search page by id.
-
#has_work? ⇒ Boolean
Used by Core.
-
#initialize(options = {}) ⇒ AbstractAdapter
constructor
A new instance of AbstractAdapter.
-
#initialized? ⇒ Boolean
Check if queue was initialized.
-
#size ⇒ Integer
Size of queue.
Constructor Details
#initialize(options = {}) ⇒ AbstractAdapter
Returns a new instance of AbstractAdapter.
204 205 206 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 204 def initialize(={}) @options = end |
Instance Method Details
#add(url, options = {}) ⇒ void
This method returns an undefined value.
Add page to queue
214 215 216 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 214 def add(url, ={}) raise NotImplementedError end |
#downloaded_count ⇒ Integer
Count of downloaded pages Using to show downloading progress.
267 268 269 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 267 def downloaded_count raise NotImplementedError end |
#fetch_downloaded(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch downloaded and not processed pages for feching
249 250 251 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 249 def fetch_downloaded(count=nil) raise NotImplementedError end |
#fetch_error(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch error page
258 259 260 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 258 def fetch_error(count=nil) raise NotImplementedError end |
#fetch_pending(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch pending page for fetching
240 241 242 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 240 def fetch_pending(count=nil) raise NotImplementedError end |
#find(id) ⇒ Page
Search page by id
223 224 225 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 223 def find(id) raise NotImplementedError end |
#has_work? ⇒ Boolean
Used by Core. It checks for pages that are not downloaded or not parsed yet.
286 287 288 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 286 def has_work? raise NotImplementedError end |
#initialized? ⇒ Boolean
Check if queue was initialized. Using for ‘seed` method. If queue was initialized, then no need to run seed block.
277 278 279 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 277 def initialized? raise NotImplementedError end |
#size ⇒ Integer
Size of queue
231 232 233 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 231 def size raise NotImplementedError end |