Sha256: e4e11c8796ea5f2545ed5d3833fa231917d470ad99ce24c3b3f8d51fa2c37334

Contents?: true

Size: 514 Bytes

Versions: 1

Compression:

Stored size: 514 Bytes

Contents

require 'yaml'
require 'symbolizer'
require 'erb'

# Helps to load conf files in salemove ecosystem
#
class ConfLoader
  # Load given conf file
  #
  # @path [String] path
  #   full path to conf
  # @path [String] env
  #   environment to load
  #
  # @return [Hash]
  #   hash with symbolized keys
  #
  # @api public
  def self.load(path, env)
    template = ERB.new File.new(path).read
    environments = YAML.load template.result(binding)
    hash = environments[env]
    Symbolizer.symbolize(hash)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conf_loader-0.2.1 lib/conf_loader.rb