class Tastevin::Config
Public Class Methods
load()
click to toggle source
# File lib/tastevin/config.rb, line 6 def self.load FileUtils.mkdir_p(path) filename = File.join(path, 'agents') inifile = IniFile.new(:filename => filename) Config.new(inifile) end
new(inifile)
click to toggle source
# File lib/tastevin/config.rb, line 50 def initialize(inifile) @inifile = inifile end
path()
click to toggle source
# File lib/tastevin/config.rb, line 15 def self.path File.join(ENV['HOME'], '.tastevin') end
Public Instance Methods
[](name)
click to toggle source
# File lib/tastevin/config.rb, line 19 def [](name) @inifile[name] end
add(agent, host, port, username, password)
click to toggle source
# File lib/tastevin/config.rb, line 31 def add(agent, host, port, username, password) @inifile[agent] = { 'host' => host, 'port' => port, 'username' => username, 'password' => password } end
exists?(agent)
click to toggle source
# File lib/tastevin/config.rb, line 23 def exists?(agent) @inifile.has_section? agent end
list()
click to toggle source
# File lib/tastevin/config.rb, line 27 def list @inifile.sections end
remove(agent)
click to toggle source
# File lib/tastevin/config.rb, line 40 def remove(agent) @inifile.delete_section agent end
save()
click to toggle source
# File lib/tastevin/config.rb, line 44 def save @inifile.write end