module Nehm::Cfg
Cfg
module manipulates with nehm’s config file (~/.nehmconfig)
Constants
- FILE_PATH
Public Class Methods
[](key)
click to toggle source
# File lib/nehm/cfg.rb, line 12 def self.[](key) config_hash[key.to_s] end
[]=(key, value)
click to toggle source
# File lib/nehm/cfg.rb, line 16 def self.[]=(key, value) config_hash[key.to_s] = value write end
create()
click to toggle source
# File lib/nehm/cfg.rb, line 21 def self.create File.new(FILE_PATH, 'w+') end
exist?()
click to toggle source
# File lib/nehm/cfg.rb, line 25 def self.exist? File.exist?(FILE_PATH) end
key?(key)
click to toggle source
# File lib/nehm/cfg.rb, line 29 def self.key?(key) config_hash.key?(key.to_s) end
Public Instance Methods
config_hash()
click to toggle source
# File lib/nehm/cfg.rb, line 35 def config_hash @config_hash ||= YAML.load_file(FILE_PATH) @config_hash ||= {} @config_hash end
write()
click to toggle source
# File lib/nehm/cfg.rb, line 42 def write IO.write(FILE_PATH, config_hash.to_yaml) end