Class: VagrantPlugins::Openstack::HttpConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-openstack-illuin-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.



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

def initialize
  @open_timeout = UNSET_VALUE
  @read_timeout = UNSET_VALUE
end

Instance Attribute Details

#open_timeoutInteger

Returns:

  • (Integer)


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

def open_timeout
  @open_timeout
end

#read_timeoutInteger

Returns:

  • (Integer)


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

def read_timeout
  @read_timeout
end

Instance Method Details

#finalize!Object



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

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

#merge(other) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vagrant-openstack-illuin-provider/config/http.rb', line 24

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