class DRbQS::Config::SSHHost
Public Class Methods
new(dir)
click to toggle source
# File lib/drbqs/config/ssh_host.rb, line 4 def initialize(dir) @dir = File.expand_path(dir) end
Public Instance Methods
config_names()
click to toggle source
# 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)
click to toggle source
@param [String] name File name without extension.
# 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)
click to toggle source
# File lib/drbqs/config/ssh_host.rb, line 26 def get_path(name) name = name.to_s name.size > 0 && find_file(name) end
Private Instance Methods
config_files()
click to toggle source
# File lib/drbqs/config/ssh_host.rb, line 8 def config_files (Dir.glob("#{@dir}/*.yaml") + Dir.glob("#{@dir}/*.yml")).sort end
find_file(name)
click to toggle source
# File lib/drbqs/config/ssh_host.rb, line 19 def find_file(name) config_files.find do |s| File.basename(s).sub(/\.ya?ml$/, '') == name end end