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)


127
128
129
# File 'lib/sshkit/host.rb', line 127

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

Instance Method Details

#hostnameObject



135
136
137
# File 'lib/sshkit/host.rb', line 135

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

#portObject



131
132
133
# File 'lib/sshkit/host.rb', line 131

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