class Utils::SshTunnelSpecification
def interpret_spec(spec_string)
def interpret_spec(spec_string) @local_addr, @local_port, @remote_addr, @remote_port = case spec_string when /\A(\d+)\z/ [ 'localhost', $1.to_i, 'localhost', $1.to_i ] when /\A(\[[^\]]+\]|[^:]+):(\d+)\z/ [ 'localhost', $2.to_i, $1, $2.to_i ] when /\A(\d+):(\[[^\]]+\]|[^:]+):(\d+)\z/ [ 'localhost', $1.to_i, $2, $3.to_i ] when /\A(\[[^\]]+\]|[^:]+):(\[[^\]]+\]|[^:]+):(\d+)\z/ [ $1, $3.to_i, $2, $3.to_i ] when /\A(\[[^\]]+\]|[^:]+):(\d+):(\[[^\]]+\]|[^:]+):(\d+)\z/ [ $1, $2.to_i, $3, $4.to_i ] end end