Sha256: 4c3cdd7ca5115414666504aa50e91f8ebe99e898c3f50157bebdc0ab14f9e86b
Contents?: true
Size: 862 Bytes
Versions: 2
Compression:
Stored size: 862 Bytes
Contents
module Ezframe class Config class << self attr_accessor :value_h def load_files(dir) unless @value_h Dir["#{dir}/*.yml"].each do |file| load_one_file(file) end end end def load_one_file(filename) instr = File.open(filename, &:read) if instr.index("\#{") instr = Template.fill_in_text(instr) end begin yaml = YAML.load(instr) rescue mylog("YAML load error: #{filename}") return end @value_h ||={} @value_h.update(yaml.recursively_symbolize_keys) if yaml.length>0 end def [](k) @value_h[k] if @value_h end def []=(k, v) @value_h||={} @value_h[k]=v end def inspect @value_h.inspect end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ezframe-0.1.1 | lib/ezframe/config.rb |
ezframe-0.1.0 | lib/ezframe/config.rb |