Sha256: e2b0a333836309035d0655d647a4a048058b3b8c04df3856b2d7e51503f91d08
Contents?: true
Size: 512 Bytes
Versions: 57
Compression:
Stored size: 512 Bytes
Contents
class ConfigStore attr_reader :file def initialize(file) @file = file end def load @config ||= YAML::load(open(file)) self end def [](key) load @config[key] end def []=(key, value) @config[key] = value end def delete(*keys) keys.each { |key| @config.delete(key) } save self end def update(c={}) @config.merge!(c) save self end def save File.open(file, 'w') { |f| f.write(YAML.dump(@config)) } self end end
Version data entries
57 entries across 57 versions & 22 rubygems