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

Inherits:
Vagrant::Plugin::V2::Config
  • Object
show all
Defined in:
lib/vagrant-proxyconf/config/apt_proxy.rb,
lib/vagrant-proxyconf/config/apt_proxy.rb

Overview

Proxy configuration for Apt

Defined Under Namespace

Classes: ConfigValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAptProxy

Returns a new instance of AptProxy.



19
20
21
22
23
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 19

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

Instance Attribute Details

#ftpString

Returns the FTP proxy.

Returns:

  • (String)

    the FTP proxy



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

def ftp
  @ftp
end

#httpString

Returns the HTTP proxy.

Returns:

  • (String)

    the HTTP proxy



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

def http
  @http
end

#httpsString

Returns the HTTPS proxy.

Returns:

  • (String)

    the HTTPS proxy



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

def https
  @https
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 36

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

#finalize!Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 25

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



41
42
43
# File 'lib/vagrant-proxyconf/config/apt_proxy.rb', line 41

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