Sha256: 72ed6f055118b21c736b79be51398e2bc069a37242677c4da29e51316ad9f2c9
Contents?: true
Size: 556 Bytes
Versions: 1
Compression:
Stored size: 556 Bytes
Contents
# encoding: utf-8 module Filegen # Data Sources module DataSources # Data source which makes yaml files available class Yaml private attr_reader :source public # Create data source def initialize(file) @source = HashWithIndifferentAccess.new(Psych.load_file(file)) rescue Errno::ENOENT raise Exceptions::YamlFileNotFound, JSON.dump(file: file) end def fetch(key, default_value = nil) source[key.to_sym] || source[key.to_s] || default_value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
filegen-0.4.3 | lib/filegen/data_sources/yaml.rb |