Class: Sidedock::PortConfiguration
- Defined in:
- lib/sidedock/port_configuration.rb
Constant Summary collapse
- CLI_FORMAT =
/(?<internal>\d*)\/(?<protocol>tcp|udp) -> .*\:(?<external>\d*)/
Instance Attribute Summary collapse
-
#external ⇒ Object
Returns the value of attribute external.
-
#internal ⇒ Object
Returns the value of attribute internal.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
-
#initialize(raw_configuration) ⇒ PortConfiguration
constructor
A new instance of PortConfiguration.
Methods inherited from Base
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
#external ⇒ Object
Returns the value of attribute external.
3 4 5 |
# File 'lib/sidedock/port_configuration.rb', line 3 def external @external end |
#internal ⇒ Object
Returns the value of attribute internal.
3 4 5 |
# File 'lib/sidedock/port_configuration.rb', line 3 def internal @internal end |
#protocol ⇒ Object
Returns the value of attribute protocol.
3 4 5 |
# File 'lib/sidedock/port_configuration.rb', line 3 def protocol @protocol end |