Class: Flotte::Host

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, hostname: nil, user: nil) ⇒ Host

Returns a new instance of Host.

Parameters:

  • name (String)
  • hostname (String) (defaults to: nil)
  • user (String) (defaults to: nil)


9
10
11
12
13
# File 'lib/flotte/host.rb', line 9

def initialize(name:, hostname: nil, user: nil)
  @name = name
  @hostname = hostname
  @user = user
end

Instance Attribute Details

#nameString (readonly)

Returns:

  • (String)


4
5
6
# File 'lib/flotte/host.rb', line 4

def name
  @name
end

#userString (readonly)

Returns:

  • (String)


4
5
6
# File 'lib/flotte/host.rb', line 4

def user
  @user
end

Instance Method Details

#hostnameString

Returns:

  • (String)


31
32
33
# File 'lib/flotte/host.rb', line 31

def hostname
  @hostname || name
end

#idString

Returns:

  • (String)


16
17
18
# File 'lib/flotte/host.rb', line 16

def id
  name
end

#ssh_destination_stringString

Returns:

  • (String)


26
27
28
# File 'lib/flotte/host.rb', line 26

def ssh_destination_string
  [user, hostname].compact.join("@")
end

#sshkit_hostSSHKit::Host

Returns:

  • (SSHKit::Host)


21
22
23
# File 'lib/flotte/host.rb', line 21

def sshkit_host
  @sshkit_host ||= SSHKit::Host.new(ssh_destination_string)
end