Class: SSHHost

Inherits:
Object
  • Object
show all
Defined in:
lib/smartos-manager/core.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: nil, address: nil, gateway: nil, user: nil, gateway_user: nil) ⇒ SSHHost

Returns a new instance of SSHHost.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/smartos-manager/core.rb', line 25

def initialize(name: nil, address: nil, gateway: nil, user: nil, gateway_user: nil)
  raise "address required" unless address
  
  @name= name
  
  @address = address
  @user = user
  
  @gateway = gateway
  @gateway_user = gateway_user
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



12
13
14
# File 'lib/smartos-manager/core.rb', line 12

def address
  @address
end

#gatewayObject (readonly)

Returns the value of attribute gateway.



13
14
15
# File 'lib/smartos-manager/core.rb', line 13

def gateway
  @gateway
end

#nameObject (readonly)

Returns the value of attribute name.



11
12
13
# File 'lib/smartos-manager/core.rb', line 11

def name
  @name
end

#userObject (readonly)

Returns the value of attribute user.



12
13
14
# File 'lib/smartos-manager/core.rb', line 12

def user
  @user
end

Class Method Details

.from_hash(name, h, global_h) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/smartos-manager/core.rb', line 15

def self.from_hash(name, h, global_h)
  new(
      name:         name,
      address:      h['address'],
      gateway:      h['gateway'] || global_h['gateway'],
      user:         h['user'] || global_h['user'],
      gateway_user: h['gateway_user'] || global_h['gateway_user']
    )
end

Instance Method Details

#gateway_userObject



41
42
43
# File 'lib/smartos-manager/core.rb', line 41

def gateway_user
  @gateway_user || user
end