Class: SSHMan::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/sshman/connection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, host, user, port, auth_type, ssh_key = nil) ⇒ Connection

Returns a new instance of Connection.



6
7
8
9
10
11
12
13
# File 'lib/sshman/connection.rb', line 6

def initialize(name, host, user, port, auth_type, ssh_key = nil)
  @name = name
  @host = host
  @user = user
  @port = port
  @auth_type = auth_type
  @ssh_key = ssh_key
end

Instance Attribute Details

#auth_typeObject

Returns the value of attribute auth_type.



4
5
6
# File 'lib/sshman/connection.rb', line 4

def auth_type
  @auth_type
end

#hostObject

Returns the value of attribute host.



4
5
6
# File 'lib/sshman/connection.rb', line 4

def host
  @host
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/sshman/connection.rb', line 4

def name
  @name
end

#portObject

Returns the value of attribute port.



4
5
6
# File 'lib/sshman/connection.rb', line 4

def port
  @port
end

#ssh_keyObject

Returns the value of attribute ssh_key.



4
5
6
# File 'lib/sshman/connection.rb', line 4

def ssh_key
  @ssh_key
end

#userObject

Returns the value of attribute user.



4
5
6
# File 'lib/sshman/connection.rb', line 4

def user
  @user
end

Class Method Details

.from_h(hash) ⇒ Object



26
27
28
# File 'lib/sshman/connection.rb', line 26

def self.from_h(hash)
  new(hash[:name], hash[:host], hash[:user], hash[:port], hash[:auth_type], hash[:ssh_key])
end

Instance Method Details

#to_hObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/sshman/connection.rb', line 15

def to_h
  {
    name: @name,
    host: @host,
    user: @user,
    port: @port,
    auth_type: @auth_type,
    ssh_key: @ssh_key
  }
end