Sha256: 52f22c2584a881892162b2cf0e86cda159dd27f04b1573e02b61645675a48d7b

Contents?: true

Size: 1.03 KB

Versions: 21

Compression:

Stored size: 1.03 KB

Contents

module VagrantPlugins
  module Invade
    module Validator

      module Network

        #(see https://docs.vagrantup.com/v2/networking/private_network.html)
        class PrivateNetwork

          attr_accessor :env
          attr_accessor :private_network

          DEFAULT = {
            'type' => 'dhcp',
            'ip' => nil # Use default. Vagrant default is NIL if not set
          }

          def initialize(env, private_network)
            @env = env
            @private_network = private_network
          end

          def validate
            return nil unless @private_network

            # NETWORK TYPE (DHCP, not used if IP is given)
            @private_network['type'] = Validator.validate_string(
              @private_network['type'], 'type', DEFAULT['type']
            )

            # IP ADDRESS
            @private_network['ip'] = Validator.validate_string(
              @private_network['ip'], 'ip', DEFAULT['ip']
            )

            @private_network
          end
        end

      end

    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
vagrant-invade-0.2.0 lib/vagrant-invade/validator/network/private_network.rb