class Uberssh::AccountManager

Constants

CONFIG_FILE

Public Class Methods

new() click to toggle source
# File lib/uberssh/account_manager.rb, line 7
def initialize
  @accounts = []
end

Public Instance Methods

account_from_name(name) click to toggle source
# File lib/uberssh/account_manager.rb, line 17
def account_from_name(name)
  accounts.detect { |a| a.name == name }
end
accounts() click to toggle source
# File lib/uberssh/account_manager.rb, line 11
def accounts
  load_accounts if @accounts.empty?

  @accounts
end
print_accounts() click to toggle source

Private Instance Methods

config_file() click to toggle source
# File lib/uberssh/account_manager.rb, line 29
def config_file
  CONFIG_FILE
end
load_accounts() click to toggle source
# File lib/uberssh/account_manager.rb, line 33
def load_accounts
  raise "No uberssh configuration found in #{config_file}." unless File.exist?(config_file)

  config = YAML.load_file(config_file)['accounts']
  config.each_pair do |k ,v|
    @accounts << Account.new(k, v)  
  end
end