Class: Flotte::Host
- Inherits:
-
Object
- Object
- Flotte::Host
- Defined in:
- lib/flotte/host.rb
Instance Attribute Summary collapse
- #name ⇒ String readonly
- #user ⇒ String readonly
Instance Method Summary collapse
- #hostname ⇒ String
- #id ⇒ String
-
#initialize(name:, hostname: nil, user: nil) ⇒ Host
constructor
A new instance of Host.
- #ssh_destination_string ⇒ String
- #sshkit_host ⇒ SSHKit::Host
Constructor Details
#initialize(name:, hostname: nil, user: nil) ⇒ Host
Returns a new instance of Host.
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
#name ⇒ String (readonly)
4 5 6 |
# File 'lib/flotte/host.rb', line 4 def name @name end |
#user ⇒ String (readonly)
4 5 6 |
# File 'lib/flotte/host.rb', line 4 def user @user end |
Instance Method Details
#hostname ⇒ String
31 32 33 |
# File 'lib/flotte/host.rb', line 31 def hostname @hostname || name end |
#id ⇒ String
16 17 18 |
# File 'lib/flotte/host.rb', line 16 def id name end |
#ssh_destination_string ⇒ String
26 27 28 |
# File 'lib/flotte/host.rb', line 26 def ssh_destination_string [user, hostname].compact.join("@") end |
#sshkit_host ⇒ SSHKit::Host
21 22 23 |
# File 'lib/flotte/host.rb', line 21 def sshkit_host @sshkit_host ||= SSHKit::Host.new(ssh_destination_string) end |