Class: Sidedock::PortConfiguration

Inherits:
Base
  • Object
show all
Defined in:
lib/sidedock/port_configuration.rb

Constant Summary collapse

CLI_FORMAT =
/(?<internal>\d*)\/(?<protocol>tcp|udp) -> .*\:(?<external>\d*)/

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#machine, machine

Constructor Details

#initialize(raw_configuration) ⇒ PortConfiguration

Returns a new instance of PortConfiguration.



6
7
8
9
10
11
# File 'lib/sidedock/port_configuration.rb', line 6

def initialize(raw_configuration)
  match = CLI_FORMAT.match raw_configuration
  @internal = match[:internal].to_i
  @external = match[:external].to_i
  @protocol = match[:protocol]
end

Instance Attribute Details

#externalObject

Returns the value of attribute external.



3
4
5
# File 'lib/sidedock/port_configuration.rb', line 3

def external
  @external
end

#internalObject

Returns the value of attribute internal.



3
4
5
# File 'lib/sidedock/port_configuration.rb', line 3

def internal
  @internal
end

#protocolObject

Returns the value of attribute protocol.



3
4
5
# File 'lib/sidedock/port_configuration.rb', line 3

def protocol
  @protocol
end