Module: Construi::Config::EnvironmentVariables

Included in:
BuildEnvironment, Links::Link
Defined in:
lib/construi/config.rb

Instance Method Summary collapse

Instance Method Details

#envObject



89
90
91
92
93
# File 'lib/construi/config.rb', line 89

def env
  env_hash.each_with_object([]) do |(k, v), a|
    a << "#{k}=#{v}" unless v.nil? || v.empty?
  end
end

#env_configured?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/construi/config.rb', line 71

def env_configured?
  key? :environment
end

#env_hashObject



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/construi/config.rb', line 75

def env_hash
  parent = with_parent({}, &:env_hash)

  child = get(:environment, {}).each_with_object({}) do |v, h|
    key, value = v.split '='

    value = ENV[key] if value.nil? || value.empty?

    h[key] = value
  end

  parent.merge child
end