Class: SengiriYaml::Loader
- Inherits:
-
Object
- Object
- SengiriYaml::Loader
- Defined in:
- lib/sengiri_yaml/loader.rb
Instance Method Summary collapse
-
#load_dir(src_dir, permitted_classes: [], aliases: false) ⇒ Hash
load divided yaml files.
Instance Method Details
#load_dir(src_dir, permitted_classes: [], aliases: false) ⇒ Hash
load divided yaml files
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/sengiri_yaml/loader.rb', line 9 def load_dir(src_dir, permitted_classes: [], aliases: false) merged_content = "" Pathname.glob("#{src_dir}/*.yml").sort.each do |yaml_path| content = yaml_path.read.gsub(/^---$/, "") merged_content << content end YAML.safe_load(merged_content, permitted_classes: permitted_classes, aliases: aliases) end |