Class: Tap::Mechanize::Request
- Inherits:
-
Task
- Object
- Task
- Tap::Mechanize::Request
- Defined in:
- lib/tap/mechanize/request.rb
Instance Method Summary collapse
-
#mechanize ⇒ Object
Returns the mechanize agent.
-
#process(requests) ⇒ Object
Submits each request in order and returns the final Page.
Instance Method Details
#mechanize ⇒ Object
Returns the mechanize agent. – Overrides the default reader to ensure the agent log is set.
12 13 14 15 16 17 18 |
# File 'lib/tap/mechanize/request.rb', line 12 def mechanize @mechanize ||= begin agent = Agent.new agent.log = app.logger agent end end |
#process(requests) ⇒ Object
Submits each request in order and returns the final Page. Returns nil if no requests are specified.
22 23 24 25 26 27 28 29 30 |
# File 'lib/tap/mechanize/request.rb', line 22 def process(requests) unless requests.kind_of?(Array) requests = [requests] end requests.inject(nil) do |last_page, request| mechanize.fetch(request) end end |