class Mozzn::Config

Attributes

data[RW]

Public Class Methods

new() click to toggle source
# File lib/mozzn/config.rb, line 11
def initialize
  read
end

Public Instance Methods

add(key, value) click to toggle source
# File lib/mozzn/config.rb, line 15
def add key, value
  self.data ||= {}
  self.data[key] = value
  self.write
end
method_missing(meth, *args, &block) click to toggle source
# File lib/mozzn/config.rb, line 33
def method_missing meth, *args, &block
  self.data[meth.to_s] if self.data && self.data.has_key?(meth.to_s)
end
rc() click to toggle source
# File lib/mozzn/config.rb, line 7
def rc
  File.expand_path("~/.mozznrc")
end
read() click to toggle source
# File lib/mozzn/config.rb, line 21
def read
  if File.exists?(self.rc)
    self.data = YAML.load_file(self.rc)
  else
    self.data = {}
  end
end
write() click to toggle source
# File lib/mozzn/config.rb, line 29
def write
  File.open(self.rc, 'w') { |f| YAML.dump(self.data, f) }
end