Class: SSHMan::Manager
- Inherits:
-
Object
- Object
- SSHMan::Manager
- Defined in:
- lib/sshman/manager.rb
Constant Summary collapse
- CONFIG_FILE =
File.('~/.sshman.yml')
Class Method Summary collapse
- .add_connection(connection) ⇒ Object
- .delete_connection(name) ⇒ Object
- .find_connection(name) ⇒ Object
- .list_connections ⇒ Object
- .update_connection(updated_connection) ⇒ Object
Class Method Details
.add_connection(connection) ⇒ Object
14 15 16 17 18 |
# File 'lib/sshman/manager.rb', line 14 def add_connection(connection) connections = load_connections connections << connection save_connections(connections) end |
.delete_connection(name) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/sshman/manager.rb', line 27 def delete_connection(name) connections = load_connections initial_count = connections.count connections.reject! { |c| c.name == name } save_connections(connections) initial_count != connections.count end |
.find_connection(name) ⇒ Object
35 36 37 |
# File 'lib/sshman/manager.rb', line 35 def find_connection(name) load_connections.find { |c| c.name == name } end |
.list_connections ⇒ Object
10 11 12 |
# File 'lib/sshman/manager.rb', line 10 def list_connections load_connections end |
.update_connection(updated_connection) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/sshman/manager.rb', line 20 def update_connection(updated_connection) connections = load_connections index = connections.index { |c| c.name == updated_connection.name } connections[index] = updated_connection if index save_connections(connections) end |