Class: Feedzirra::Reader
- Inherits:
-
Object
- Object
- Feedzirra::Reader
- Defined in:
- lib/feedzirra/reader.rb
Overview
Class Reader
is an experimental interface for fetching and parsing Feed
objects, using pluggable and (optionally) persistent backends to maintain state for fetched feeds.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#urls ⇒ Object
readonly
Returns the value of attribute urls.
Instance Method Summary collapse
-
#fetch ⇒ Object
Map all urls to Feed objects, pulling existing feeds from Backend where available, then slices and fetches feeds in chunks of 30.
-
#initialize(*args) ⇒ Reader
constructor
A new instance of Reader.
Constructor Details
#initialize(*args) ⇒ Reader
Returns a new instance of Reader.
9 10 11 12 |
# File 'lib/feedzirra/reader.rb', line 9 def initialize(*args) @options = args. @urls = args.flatten end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/feedzirra/reader.rb', line 7 def @options end |
#urls ⇒ Object (readonly)
Returns the value of attribute urls.
7 8 9 |
# File 'lib/feedzirra/reader.rb', line 7 def urls @urls end |
Instance Method Details
#fetch ⇒ Object
Map all urls to Feed objects, pulling existing feeds from Backend where available, then slices and fetches feeds in chunks of 30.
16 17 18 19 20 |
# File 'lib/feedzirra/reader.rb', line 16 def fetch multi = multi_from(@urls, @options) multi.run multi.responses.size == 1 ? multi.responses.values.first : multi.responses.values end |