Sha256: bdea31f1df8f4b88647aa83bafab0111d4e0315949351b7de3029d1ae8d497e8

Contents?: true

Size: 421 Bytes

Versions: 2

Compression:

Stored size: 421 Bytes

Contents

module SengiriYaml
  require "yaml"

  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") 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.1 lib/sengiri_yaml/loader.rb
sengiri_yaml-0.0.1.beta1 lib/sengiri_yaml/loader.rb