instance method
parse_env_file
Ruby on Rails edge
Since edge Private — implementation detail, not part of the public APISignature
parse_env_file()
No documentation comment.
Source
# File activesupport/lib/active_support/dot_env_configuration.rb, line 52
def parse_env_file
if File.exist?(@path.to_s)
envs = {}
File.foreach(@path) do |line|
line = line.strip
next if line.empty? || line.start_with?("#")
# Match KEY=value pattern
if line =~ /\A([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\z/
key, value = $1, $2
envs[key] = interpolate(execute_commands(unquote(strip_inline_comment(value))), envs)
end
end
envs
else
{}
end
end
Defined in activesupport/lib/active_support/dot_env_configuration.rb line 52
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveSupport::DotEnvConfiguration