Sha256: 28fe57131585a1c5ed895165c768378fa1da59d4fec1ba0354859b703fc2d766

Contents?: true

Size: 564 Bytes

Versions: 1

Compression:

Stored size: 564 Bytes

Contents

require 'yaml'

module Prefab
  class YAMLConfigParser
    def initialize(file, client)
      @file = file
      @client = client
    end

    def merge(config)
      yaml = load

      yaml.each do |k, v|
        config = Prefab::LocalConfigParser.parse(k, v, config, @file)
      end

      config
    end

    private

    def load
      if File.exist?(@file)
        @client.log_internal Logger::INFO, "Load #{@file}"
        YAML.load_file(@file)
      else
        @client.log_internal Logger::INFO, "No file #{@file}"
        {}
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prefab-cloud-ruby-0.21.0 lib/prefab/yaml_config_parser.rb