Sha256: 7179f9c54556dc63b75134db9bdb5455609c4655a3c091f6031e634e726d2a7e

Contents?: true

Size: 452 Bytes

Versions: 2

Compression:

Stored size: 452 Bytes

Contents

module SengiriYaml
  require "yaml"
  require "pathname"

  class Loader
    # load divided yaml files
    # @param src_dir [String] divided yaml dir
    # @return [Hash] merged yaml hash
    def load_dir(src_dir)
      merged_content = ""

      Pathname.glob("#{src_dir}/*.yml").sort.each do |yaml_path|
        content = yaml_path.read.gsub(/^---$/, "")
        merged_content << content
      end

      YAML.load(merged_content)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sengiri_yaml-0.0.4 lib/sengiri_yaml/loader.rb
sengiri_yaml-0.0.3 lib/sengiri_yaml/loader.rb