Class: VagrantPlugins::Openstack::HttpConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-openstack-provider/config/http.rb

Constant Summary collapse

UNSET_VALUE =
Vagrant.plugin('2', :config).const_get(:UNSET_VALUE)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHttpConfig

Returns a new instance of HttpConfig.



18
19
20
21
22
# File 'lib/vagrant-openstack-provider/config/http.rb', line 18

def initialize
  @open_timeout = UNSET_VALUE
  @read_timeout = UNSET_VALUE
  @proxy = UNSET_VALUE
end

Instance Attribute Details

#open_timeoutInteger

Returns:

  • (Integer)


8
9
10
# File 'lib/vagrant-openstack-provider/config/http.rb', line 8

def open_timeout
  @open_timeout
end

#proxyInteger

Returns:

  • (Integer)


16
17
18
# File 'lib/vagrant-openstack-provider/config/http.rb', line 16

def proxy
  @proxy
end

#read_timeoutInteger

Returns:

  • (Integer)


12
13
14
# File 'lib/vagrant-openstack-provider/config/http.rb', line 12

def read_timeout
  @read_timeout
end

Instance Method Details

#finalize!Object



24
25
26
27
28
# File 'lib/vagrant-openstack-provider/config/http.rb', line 24

def finalize!
  @open_timeout = 60 if @open_timeout == UNSET_VALUE
  @read_timeout = 30 if @read_timeout == UNSET_VALUE
  @proxy = nil if @proxy == UNSET_VALUE
end

#merge(other) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vagrant-openstack-provider/config/http.rb', line 30

def merge(other)
  result = self.class.new

  [self, other].each do |obj|
    obj.instance_variables.each do |key|
      next if key.to_s.start_with?('@__')

      value = obj.instance_variable_get(key)
      result.instance_variable_set(key, value) if value != UNSET_VALUE
    end
  end
  result
end