Sha256: 195fc485559be3f6fc4818195e77086a233c94be68abff38ea5c910c6236ca18

Contents?: true

Size: 417 Bytes

Versions: 1

Compression:

Stored size: 417 Bytes

Contents

require "figaro/railtie"

module Figaro
  extend self

  def env
    flatten(raw).merge(raw.fetch(environment, {}))
  end

  def raw
    yaml && YAML.load(yaml) || {}
  end

  def yaml
    File.exist?(path) ? File.read(path) : nil
  end

  def path
    Rails.root.join("config/application.yml")
  end

  def environment
    Rails.env
  end

  private

  def flatten(hash)
    hash.reject{|_,v| Hash === v }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
figaro-0.4.1 lib/figaro.rb