Class: Mechanize::Chain

Inherits:
Object
  • Object
show all
Defined in:
lib/mechanize/chain.rb,
lib/mechanize/chain/auth_headers.rb,
lib/mechanize/chain/ssl_resolver.rb,
lib/mechanize/chain/uri_resolver.rb,
lib/mechanize/chain/custom_headers.rb,
lib/mechanize/chain/header_resolver.rb,
lib/mechanize/chain/response_reader.rb,
lib/mechanize/chain/pre_connect_hook.rb,
lib/mechanize/chain/request_resolver.rb,
lib/mechanize/chain/parameter_resolver.rb,
lib/mechanize/chain/connection_resolver.rb,
lib/mechanize/chain/response_body_parser.rb,
lib/mechanize/chain/body_decoding_handler.rb,
lib/mechanize/chain/response_header_handler.rb

Defined Under Namespace

Classes: AuthHeaders, BodyDecodingHandler, ConnectionResolver, CustomHeaders, HeaderResolver, ParameterResolver, PostConnectHook, PreConnectHook, RequestResolver, ResponseBodyParser, ResponseHeaderHandler, ResponseReader, SSLResolver, URIResolver

Instance Method Summary collapse

Constructor Details

#initialize(list) ⇒ Chain

Returns a new instance of Chain.



18
19
20
21
# File 'lib/mechanize/chain.rb', line 18

def initialize(list)
  @list = list
  @list.each { |l| l.chain = self }
end

Instance Method Details

#handle(request) ⇒ Object



23
24
25
# File 'lib/mechanize/chain.rb', line 23

def handle(request)
  @list.first.handle(self, request)
end

#pass(obj, request) ⇒ Object



27
28
29
30
# File 'lib/mechanize/chain.rb', line 27

def pass(obj, request)
  next_link = @list[@list.index(obj) + 1]
  next_link.handle(self, request) if next_link
end