Class: DRbQS::Config::SSHHost

Inherits:
Object
  • Object
show all
Defined in:
lib/drbqs/config/ssh_host.rb

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ SSHHost

Returns a new instance of SSHHost.



4
5
6
# File 'lib/drbqs/config/ssh_host.rb', line 4

def initialize(dir)
  @dir = File.expand_path(dir)
end

Instance Method Details

#config_namesObject



13
14
15
16
17
# File 'lib/drbqs/config/ssh_host.rb', line 13

def config_names
  config_files.map do |s|
    File.basename(s).sub(/\.ya?ml$/, '')
  end
end

#get_options(name) ⇒ Object

Parameters:

  • name (String)

    File name without extension.



32
33
34
35
36
37
# File 'lib/drbqs/config/ssh_host.rb', line 32

def get_options(name)
  if path = get_path(name)
    return [path, YAML.load_file(path)]
  end
  [nil, {}]
end

#get_path(name) ⇒ Object



26
27
28
29
# File 'lib/drbqs/config/ssh_host.rb', line 26

def get_path(name)
  name = name.to_s
  name.size > 0 && find_file(name)
end