Class: LocalPac::ProxyPac::ResultParser::PacResultHtmlStylist

Inherits:
Object
  • Object
show all
Defined in:
lib/local_pac/proxy_pac/result_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PacResultHtmlStylist

Returns a new instance of PacResultHtmlStylist.



8
9
10
11
12
# File 'lib/local_pac/proxy_pac/result_parser.rb', line 8

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

Instance Attribute Details

#class_proxyObject (readonly)

Returns the value of attribute class_proxy.



6
7
8
# File 'lib/local_pac/proxy_pac/result_parser.rb', line 6

def class_proxy
  @class_proxy
end

#class_proxy_portObject (readonly)

Returns the value of attribute class_proxy_port.



6
7
8
# File 'lib/local_pac/proxy_pac/result_parser.rb', line 6

def class_proxy_port
  @class_proxy_port
end

Instance Method Details

#style_me(result) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/local_pac/proxy_pac/result_parser.rb', line 14

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