Class: Scrapes::ToProxy
- Inherits:
-
Object
- Object
- Scrapes::ToProxy
- Defined in:
- lib/scrapes/to_proxy.rb
Overview
Link pages together. Useful for when one only contains links to the next page.
Instance Method Summary collapse
- #extract(data, uri, session, &block) ⇒ Object
-
#initialize(from, to) ⇒ ToProxy
constructor
A new instance of ToProxy.
-
#to(next_in_line) ⇒ Object
Continue the string of connections.
Constructor Details
#initialize(from, to) ⇒ ToProxy
Returns a new instance of ToProxy.
30 31 32 |
# File 'lib/scrapes/to_proxy.rb', line 30 def initialize (from, to) @from, @to = from, to end |
Instance Method Details
#extract(data, uri, session, &block) ⇒ Object
35 36 37 38 39 |
# File 'lib/scrapes/to_proxy.rb', line 35 def extract (data, uri, session, &block) @from.extract(data, uri, session) do |link| session.page(@to, link, &block) end end |
#to(next_in_line) ⇒ Object
Continue the string of connections.
43 44 45 |
# File 'lib/scrapes/to_proxy.rb', line 43 def to (next_in_line) self.class.new(self, next_in_line) end |