Class: LocalPac::ProxyPac::PacResultHtmlStylist

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PacResultHtmlStylist

Returns a new instance of PacResultHtmlStylist.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 6

def initialize(options = {})
  @class_main_container    = options.fetch(:class_main_container, 'lp_main_container')
  @class_element_container = options.fetch(:class_element_container, 'lp_element_container')
  @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')
  @class_unimportant       = options.fetch(:class_unimportant, 'lp_unimportant')
  @class_header            = options.fetch(:class_header, 'lp_header')
  #@html_style             = options.fetch(:html_style, HTMLTableStyle.new(main_container_class: class_main_container, element_container_class: class_element_container))
  @html_style              = options.fetch(:html_style, HTMLDivStyle.new(main_container_css_class: class_main_container, element_container_css_class: class_element_container))
  @html_data               = options.fetch(:html_styler, HTMLData)
end

Instance Attribute Details

#class_element_containerObject (readonly)

Returns the value of attribute class_element_container.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_element_container
  @class_element_container
end

#class_headerObject (readonly)

Returns the value of attribute class_header.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_header
  @class_header
end

#class_main_containerObject (readonly)

Returns the value of attribute class_main_container.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_main_container
  @class_main_container
end

#class_proxyObject (readonly)

Returns the value of attribute class_proxy.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_proxy
  @class_proxy
end

#class_proxy_portObject (readonly)

Returns the value of attribute class_proxy_port.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_proxy_port
  @class_proxy_port
end

#class_request_typeObject (readonly)

Returns the value of attribute class_request_type.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_request_type
  @class_request_type
end

#class_unimportantObject (readonly)

Returns the value of attribute class_unimportant.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def class_unimportant
  @class_unimportant
end

#html_dataObject (readonly)

Returns the value of attribute html_data.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def html_data
  @html_data
end

#html_styleObject (readonly)

Returns the value of attribute html_style.



4
5
6
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 4

def html_style
  @html_style
end

Instance Method Details

#style_me(result) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/local_pac/proxy_pac/pac_result_html_stylist.rb', line 19

def style_me(result)
  html_style.add_data(html_data.new(element: result.request_type, element_css_class: class_request_type, header: I18n.t('models.data.request_type'), header_css_class: class_header ))

  if result.proxy
    html_style.add_data(html_data.new(element: result.proxy, element_css_class: class_proxy, header: I18n.t('models.data.proxy'), header_css_class: class_header ))
  end

  if result.proxy_port
    html_style.add_data(html_data.new(element: result.proxy_port, element_css_class: class_request_type, header: I18n.t('models.data.proxy_port'), header_css_class: class_header ))
  end

  result.styled_content = html_style.to_s
end