Class: VagrantPlugins::PortRange::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-port-range/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



8
9
10
# File 'lib/vagrant-port-range/config.rb', line 8

def initialize
    @forwarded_ports = {}
end

Instance Attribute Details

#forwarded_portsObject (readonly)

Returns the value of attribute forwarded_ports.



6
7
8
# File 'lib/vagrant-port-range/config.rb', line 6

def forwarded_ports
  @forwarded_ports
end

Instance Method Details

#forwarded_port(**options) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/vagrant-port-range/config.rb', line 12

def forwarded_port(**options)
    options = options.dup

    if !options[:id]
        options[:id] = "#{SecureRandom.uuid}"
    end

    id = options[:id]
    forwarded_ports[id] = options
end