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.
194 195 196 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 194 def initialize(={}) = end |
Instance Method Details
#add(url, options = {}) ⇒ void
This method returns an undefined value.
Add page to queue
204 205 206 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 204 def add(url, ={}) raise NotImplementedError end |
#downloaded_count ⇒ Integer
Count of downloaded pages Using to show downloading progress.
257 258 259 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 257 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
239 240 241 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 239 def fetch_downloaded(count=nil) raise NotImplementedError end |
#fetch_error(count = nil) ⇒ Scruber::QueueAdapters::AbstractAdapter::Page|Array<Scruber::QueueAdapters::AbstractAdapter::Page>
Fetch error page
248 249 250 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 248 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
230 231 232 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 230 def fetch_pending(count=nil) raise NotImplementedError end |
#find(id) ⇒ Page
Search page by id
213 214 215 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 213 def find(id) raise NotImplementedError end |
#has_work? ⇒ Boolean
Used by Core. It checks for pages that are not downloaded or not parsed yet.
276 277 278 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 276 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.
267 268 269 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 267 def initialized? raise NotImplementedError end |
#size ⇒ Integer
Size of queue
221 222 223 |
# File 'lib/scruber/queue_adapters/abstract_adapter.rb', line 221 def size raise NotImplementedError end |