Class: VagrantPlugins::ProxyConf::Config::AptProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-proxyconf/config/apt_proxy.rb

Defined Under Namespace

Classes: ConfigValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAptProxy

Returns a new instance of AptProxy.



16
17
18
19
20
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 16

def initialize
  @http  = UNSET_VALUE
  @https = UNSET_VALUE
  @ftp   = UNSET_VALUE
end

Instance Attribute Details

#ftpObject

FTP proxy for Apt



14
15
16
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 14

def ftp
  @ftp
end

#httpObject

HTTP proxy for Apt



8
9
10
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 8

def http
  @http
end

#httpsObject

HTTPS proxy for Apt



11
12
13
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 11

def https
  @https
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 33

def enabled?
  !http.nil? || !https.nil? || !ftp.nil?
end

#finalize!Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 22

def finalize!
  @http = override_from_env_var('http', @http)
  @http = nil if @http == UNSET_VALUE

  @https = override_from_env_var('https', @https)
  @https = nil if @https == UNSET_VALUE

  @ftp = override_from_env_var('ftp', @ftp)
  @ftp = nil if @ftp == UNSET_VALUE
end

#to_sString

Returns the full configuration stanza.

Returns:

  • (String)

    the full configuration stanza



38
39
40
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 38

def to_s
  %w[http https ftp].map { |proto| config_for(proto) }.join
end