Sha256: 9e660d115a5f696c7c73ad0e8d81a124d48b921faefeaafe8cf35ae9a56c35e8
Contents?: true
Size: 584 Bytes
Versions: 1
Compression:
Stored size: 584 Bytes
Contents
require 'yaml' require 'deepstruct' module Hobo module Config class File def self.save(file, config) config = config.unwrap if config.respond_to? :unwrap dir = ::File.dirname file FileUtils.mkdir_p dir unless ::File.exists? dir ::File.open(file, 'w+') do |f| f.puts config.to_yaml end end def self.load(file) config = ::File.exists?(file) ? YAML.load_file(file) : {} raise "Invalid hobo configuration (#{file})" unless config return DeepStruct.wrap(config) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hobo-inviqa-0.0.6 | lib/hobo/config/file.rb |