Sha256: fd12a45c36f39f65d4c621c916c3905d51ebe777494c9f3cbe3ce1548ff37bf7

Contents?: true

Size: 909 Bytes

Versions: 11

Compression:

Stored size: 909 Bytes

Contents

module VagrantPlugins
  module ConoHa
    class HttpConfig
      UNSET_VALUE = Vagrant.plugin('2', :config).const_get(:UNSET_VALUE)

      #
      # @return [Integer]
      attr_accessor :open_timeout

      #
      # @return [Integer]
      attr_accessor :read_timeout

      def initialize
        @open_timeout = UNSET_VALUE
        @read_timeout = UNSET_VALUE
      end

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

      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
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vagrant-conoha-0.1.10 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.9 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.8 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.7 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.6 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.5 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.4 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.3 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.2 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.1 lib/vagrant-conoha/config/http.rb
vagrant-conoha-0.1.0 lib/vagrant-conoha/config/http.rb