Sha256: 1322ef507cc00a49c62e5d4907c3e567615e76c2bfca4b6c7073111fc5bbc59a

Contents?: true

Size: 556 Bytes

Versions: 17

Compression:

Stored size: 556 Bytes

Contents

require 'yaml'

module Prefab
  class YAMLConfigParser
    LOG = Prefab::InternalLogger.new(self)

    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)
        LOG.info "Load #{@file}"
        YAML.load_file(@file)
      else
        LOG.info "No file #{@file}"
        {}
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
prefab-cloud-ruby-1.8.8.pre.1 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.7 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.6 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.5 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.4 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.3 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.2 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.1 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.8.0 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.7.2 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.7.1 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.7.0 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.6.2 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.6.1 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.6.0 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.6.0.pre2 lib/prefab/yaml_config_parser.rb
prefab-cloud-ruby-1.6.0.pre1 lib/prefab/yaml_config_parser.rb