Class: ProxyPacRb::Rules::ContainerProxyPacFunction

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

Overview

A proxy pac needs to contain FindProxyForURL

Instance Method Summary collapse

Instance Method Details

#lint(proxy_pac) ⇒ Object

Raises:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/proxy_pac_rb/proxy_pac_linter.rb', line 41

def lint(proxy_pac)
  message = if proxy_pac.type? :string
              %(proxy.pac is only given as string "#{proxy_pac.source}" and does not contain "FindProxyForURL".)
            elsif proxy_pac.type? :url
              %(proxy.pac-url "#{proxy_pac.source}" does not contain "FindProxyForURL".)
            else
              %(proxy.pac-file "#{proxy_pac.source}" does not contain "FindProxyForURL".)
            end

  raise LinterError, message unless proxy_pac.content.to_s.include?('FindProxyForURL')

  self
end