Class: Natives::Catalog::Loader
- Inherits:
-
Object
- Object
- Natives::Catalog::Loader
- Defined in:
- lib/natives/catalog/loader.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Loader
constructor
A new instance of Loader.
- #load_from_paths(paths) ⇒ Object
- #load_yaml_file(filename) ⇒ Object
- #yaml_files_in_path(path) ⇒ Object
Constructor Details
Instance Method Details
#load_from_paths(paths) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/natives/catalog/loader.rb', line 12 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) ⇒ Object
26 27 28 |
# File 'lib/natives/catalog/loader.rb', line 26 def load_yaml_file(filename) YAML.load_file(filename) end |
#yaml_files_in_path(path) ⇒ Object
22 23 24 |
# File 'lib/natives/catalog/loader.rb', line 22 def yaml_files_in_path(path) Dir.glob(File.join(path, '*.{yml,yaml}')) end |