Class: Utils::SshTunnelSpecification

Inherits:
Object
  • Object
show all
Defined in:
lib/utils/ssh_tunnel_specification.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec_string) ⇒ SshTunnelSpecification

Returns a new instance of SshTunnelSpecification.



3
4
5
# File 'lib/utils/ssh_tunnel_specification.rb', line 3

def initialize(spec_string)
  interpret_spec(spec_string)
end

Instance Attribute Details

#local_addrObject (readonly)

Returns the value of attribute local_addr.



7
8
9
# File 'lib/utils/ssh_tunnel_specification.rb', line 7

def local_addr
  @local_addr
end

#local_portObject (readonly)

Returns the value of attribute local_port.



9
10
11
# File 'lib/utils/ssh_tunnel_specification.rb', line 9

def local_port
  @local_port
end

#remote_addrObject (readonly)

Returns the value of attribute remote_addr.



11
12
13
# File 'lib/utils/ssh_tunnel_specification.rb', line 11

def remote_addr
  @remote_addr
end

#remote_portObject (readonly)

Returns the value of attribute remote_port.



13
14
15
# File 'lib/utils/ssh_tunnel_specification.rb', line 13

def remote_port
  @remote_port
end

Instance Method Details

#to_aObject



15
16
17
# File 'lib/utils/ssh_tunnel_specification.rb', line 15

def to_a
  [ local_addr, local_port, remote_addr, remote_port ]
end

#to_sObject



25
26
27
# File 'lib/utils/ssh_tunnel_specification.rb', line 25

def to_s
  to_a * ':'
end

#valid?Boolean

Returns:

  • (Boolean)


19
20
21
22
23
# File 'lib/utils/ssh_tunnel_specification.rb', line 19

def valid?
  if to_a.all?
    to_s
  end
end