Sha256: 02f4607e93ed2c8d733149d92a15ed5d3154503b76d78863cd57af29ad803243
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
module Reap class Project # = Project Settings # # Configuration settings (from .reap file). class Settings < Hash REAP_FILE = '{.reap,_reap,reapfile}{.yaml,.yml,}' def self.read(location, metadata) if File.file?(location) file = location else file = Dir.glob(File.join(location, REAP_FILE), File::FNM_CASEFOLD).first end if file data = YAML::load(File.open(file)) || {} else data = {} end new(data, metadata) end def initialize(data, metadata) super() @metadata = metadata settings = {} data.each do |key, value| settings[key] ||= {} settings[key].update(value) if value end update(settings) end # open hash def method_missing(s, *a) if s =~ /=$/ self[s] = a[0] elsif a.empty? self[s] else super end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reap-9.4.0 | lib/reap/settings.rb |