Class: Zemanta::Fetcher
- Inherits:
-
Object
- Object
- Zemanta::Fetcher
- Defined in:
- lib/zemanta/fetcher.rb,
lib/zemanta/fetcher/web.rb,
lib/zemanta/fetcher/cache.rb,
lib/zemanta/fetcher/parser.rb,
lib/zemanta/fetcher/cache/key.rb,
lib/zemanta/fetcher/cache/response.rb,
lib/zemanta/fetcher/cache/null_response.rb
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Fetcher
constructor
A new instance of Fetcher.
- #post ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Fetcher
Returns a new instance of Fetcher.
3 4 5 |
# File 'lib/zemanta/fetcher.rb', line 3 def initialize(opts = {}) @opts = opts end |
Instance Method Details
#post ⇒ Object
7 8 9 10 11 |
# File 'lib/zemanta/fetcher.rb', line 7 def post @response = cache.fetch || web.fetch cache.save(@response) parse(@response) end |