Class: ProxyPacRb::ProxyPacLinter

Inherits:
Object
  • Object
show all
Defined in:
lib/proxy_pac_rb/proxy_pac_linter.rb

Overview

Dump Proxy pac to file system

Instance Method Summary collapse

Constructor Details

#initialize(silent: false) ⇒ ProxyPacLinter

Returns a new instance of ProxyPacLinter.



12
13
14
15
16
17
18
# File 'lib/proxy_pac_rb/proxy_pac_linter.rb', line 12

def initialize(silent: false)
  @rules = []
  @rules << Rules::ContainerProxyPacFunction.new
  @rules << Rules::CanBeParsed.new

  @silent = silent
end

Instance Method Details

#lint(proxy_pac) ⇒ Object

Load proxy pac

Parameters:

  • proxy_pac (#source)

    The proxy.pac



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/proxy_pac_rb/proxy_pac_linter.rb', line 24

def lint(proxy_pac)
  return unless proxy_pac.readable?

  rules.each { |r| r.lint(proxy_pac) }

  proxy_pac.valid = true
rescue LinterError => err
  # $stderr.puts err.message unless silent

  proxy_pac.message = err.message
  proxy_pac.valid = false
end