Sha256: f5a70d4f5758d682d7993163a7d91e54f530bba32ab5d6cbc3e49feaa71cf603
Contents?: true
Size: 710 Bytes
Versions: 1
Compression:
Stored size: 710 Bytes
Contents
require 'yaml' class Isomer::Sources::Yaml < Isomer::Sources::Base attr_reader :file, :base, :required def initialize(parameters, options={}) @file = options[:file] raise Isomer::Error, "YAML source requires the 'file' parameter" if file.nil? || file.empty? @base = options[:base] @required = !!options[:required] super(parameters) end def load if File.exists?(file) values = YAML.load_file(file) if base && values.has_key?(base) @configuration = values[base] else @configuration = values end else raise Isomer::Error, "Missing required configuration file '#{file}'" if required @configuration = {} end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
isomer-0.1.0 | lib/isomer/sources/yaml.rb |