Sha256: 92335e485d9823460bc2c8aea88002a311c79cf8a11df32d24167b4152a61361
Contents?: true
Size: 1.4 KB
Versions: 16
Compression:
Stored size: 1.4 KB
Contents
# encoding: utf-8 module LocalPac module ProxyPac class ResultParser class PacResultHtmlStylist attr_reader :class_proxy_port, :class_proxy, :class_proxy_port def initialize(options = {}) @class_request_type = options.fetch(:class_request_type, 'lp_request_type') @class_proxy = options.fetch(:class_proxy, 'lp_proxy') @class_proxy_port = options.fetch(:class_proxy_port, 'lp_proxy_port') end def style_me(result) styled_result = [] styled_result << span(result.request_type, class_request_type) if result.request_type styled_result << " " if result.proxy || result.proxy_port styled_result << span(result.proxy, class_proxy) if result.proxy if result.proxy_port styled_result << ':' styled_result << span(result.proxy_port, class_proxy_port) end result.styled_content = styled_content.join end private def span(content, css_class) "<span class=\"#{css_class}\">#{content}</span>" end end def parse(string) regex.match(string) result = PacResult.new(string) end private def regex %q{"(?<type>[A-Z]+)\s+(?:(?<host>[0-9]{1,3}(:?\.[0-9]{1,3}){3}):(?<port>[0-9]+))?;?"} end end end end
Version data entries
16 entries across 16 versions & 1 rubygems