Sha256: 421ef36a1a95b856302b9a8b8e829560488e867b415996f54c124d00778d2fc6
Contents?: true
Size: 656 Bytes
Versions: 9
Compression:
Stored size: 656 Bytes
Contents
require 'natives/catalog/merger' require 'yaml' module Natives class Catalog class Loader def initialize(opts={}) @merger = opts.fetch(:merger, Merger.new) end def load_from_paths(paths) master_hash = {} Array(paths).each do |path| yaml_files_in_path(path).sort.each do |file| @merger.merge_catalog!(master_hash, load_yaml_file(file)) end end master_hash end def yaml_files_in_path(path) Dir.glob(File.join(path, '*.{yml,yaml}')) end def load_yaml_file(filename) YAML.load_file(filename) end end end end
Version data entries
9 entries across 9 versions & 2 rubygems