Class: ProxyPacRb::ProxyPacFileLoader

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

Overview

Load proxy pac from file

Instance Method Summary collapse

Instance Method Details

#load(proxy_pac) ⇒ Object



69
70
71
72
73
74
# File 'lib/proxy_pac_rb/proxy_pac_loader.rb', line 69

def load(proxy_pac)
  content = ::File.read(proxy_pac.source.to_s).chomp

  proxy_pac.content = content
  proxy_pac.type    = :file
end

#suitable_for?(proxy_pac) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
79
80
81
82
# File 'lib/proxy_pac_rb/proxy_pac_loader.rb', line 76

def suitable_for?(proxy_pac)
  return false if proxy_pac.nil? || proxy_pac.source.nil?

  path = Pathname.new(proxy_pac.source)

  path.relative? || path.absolute?
end