class Monkey::Config
Constants
- CONFIG_PATH
Attributes
hash[R]
Public Class Methods
new()
click to toggle source
# File lib/monkey/config.rb, line 9 def initialize FileUtils.touch(CONFIG_PATH) config_file = File.open(CONFIG_PATH, "rt") hash = YAML.load(config_file) if hash @hash = hash else @hash = {} end config_file.close end
Public Instance Methods
[](option)
click to toggle source
# File lib/monkey/config.rb, line 27 def [](option) @hash[option] end
[]=(option, val)
click to toggle source
# File lib/monkey/config.rb, line 31 def []=(option, val) @hash[option] = val end
empty?()
click to toggle source
# File lib/monkey/config.rb, line 23 def empty? @hash.empty? end
save!()
click to toggle source
# File lib/monkey/config.rb, line 35 def save! File.open(CONFIG_PATH, "w") {|f| f.write(@hash.to_yaml) } end