Class: SSHKit::HostWithPortParser

Inherits:
SimpleHostParser
  • Object
show all
Defined in:
lib/sshkit/host.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.suitable?(host_string) ⇒ Boolean

Returns:

  • (Boolean)


144
145
146
# File 'lib/sshkit/host.rb', line 144

def self.suitable?(host_string)
  !host_string.match(/@|\[|\]/)
end

Instance Method Details

#hostnameObject



152
153
154
# File 'lib/sshkit/host.rb', line 152

def hostname
  @host_string.split(':').first
end

#portObject



148
149
150
# File 'lib/sshkit/host.rb', line 148

def port
  @host_string.split(':').last.to_i
end