Sha256: db2127d5a1a98b3ead4d925fa66e7edde42d2b48c2adac1e0237a350eb03d393
Contents?: true
Size: 850 Bytes
Versions: 11
Compression:
Stored size: 850 Bytes
Contents
# encoding: utf-8 module LocalPac module ProxyPac class PacParser private attr_reader :engine, :file, :result_generator, :stylist public def initialize(options = {}) @file = options.fetch(:file) @engine = options.fetch(:engine, PACEngine.new(file: @file)) @result_generator = options.fetch(:result_generator, PacResult) @stylist = options.fetch(:stylist, PacResultHtmlStylist.new) rescue KeyError => e fail ArgumentError, "Argument is missing: #{e.message}" end def find(uri) uri = Addressable::URI.heuristic_parse(uri) raise Exceptions::GivenUrlInvalid, uri unless uri.host result = result_generator.new(engine.find(uri)) stylist.style_me(result) result end end end end
Version data entries
11 entries across 11 versions & 1 rubygems