Sha256: bb0222d8a45be619139804817babfd1d70608266427e5dd25a5904e5a6d06c15
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
module WWW class Mechanize class Chain class ResponseBodyParser include WWW::Handler def initialize(pluggable_parser, watch_for_set) @pluggable_parser = pluggable_parser @watch_for_set = watch_for_set end def handle(ctx, params) response = params[:response] response_body = params[:response_body] uri = params[:uri] content_type = nil unless response['Content-Type'].nil? data = response['Content-Type'].match(/^([^;]*)/) content_type = data[1].downcase unless data.nil? end # Find our pluggable parser params[:page] = @pluggable_parser.parser(content_type).new( uri, response, response_body, response.code ) { |parser| parser.mech = params[:agent] if parser.respond_to? :mech= if parser.respond_to?(:watch_for_set=) && @watch_for_set parser.watch_for_set = @watch_for_set end } super end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems