Sha256: f043428b187a84fc60cd9f885ae234f49f2c6d2dbcbef9a32100643f979d32a9
Contents?: true
Size: 803 Bytes
Versions: 1
Compression:
Stored size: 803 Bytes
Contents
require "figaro/env" require "figaro/railtie" require "figaro/tasks" module Figaro extend self def vars(custom_environment = nil) env(custom_environment).map{|k,v| "#{k}=#{v}" }.sort.join(" ") end def env(custom_environment = nil) environment = (custom_environment || self.environment).to_s Figaro::Env.from(stringify(flatten(raw).merge(raw.fetch(environment, {})))) end def raw @raw ||= yaml && YAML.load(yaml) || {} end def yaml @yaml ||= File.exist?(path) ? File.read(path) : nil end def path @path ||= Rails.root.join("config/application.yml") end def environment Rails.env end private def flatten(hash) hash.reject{|_,v| Hash === v } end def stringify(hash) hash.inject({}){|h,(k,v)| h[k.to_s] = v.to_s; h } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
figaro-0.5.1 | lib/figaro.rb |