class Natives::Catalog::Loader
Public Class Methods
new(opts={})
click to toggle source
# File lib/natives/catalog/loader.rb, line 7 def initialize(opts={}) @merger = opts.fetch(:merger, Merger.new) end
Public Instance Methods
load_from_paths(paths)
click to toggle source
# File lib/natives/catalog/loader.rb, line 11 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
load_yaml_file(filename)
click to toggle source
# File lib/natives/catalog/loader.rb, line 25 def load_yaml_file(filename) YAML.load_file(filename) end
yaml_files_in_path(path)
click to toggle source
# File lib/natives/catalog/loader.rb, line 21 def yaml_files_in_path(path) Dir.glob(File.join(path, '*.{yml,yaml}')) end