Dotenv

Constants

VERSION

Public Class Methods

load(*filenames) click to toggle source
# File lib/dotenv.rb, line 5
def self.load(*filenames)
  with(*filenames) { |f| Environment.new(f).apply if File.exists?(f) }
end
load!(*filenames) click to toggle source

same as `load`, but raises Errno::ENOENT if any files don’t exist

# File lib/dotenv.rb, line 10
def self.load!(*filenames)
  with(*filenames) { |f| Environment.new(f).apply }
end
overload(*filenames) click to toggle source

same as `load`, but will override existing values in `ENV`

# File lib/dotenv.rb, line 15
def self.overload(*filenames)
  with(*filenames) { |f| Environment.new(f).apply! if File.exists?(f) }
end

Protected Class Methods

with(*filenames, &block) click to toggle source
# File lib/dotenv.rb, line 21
def self.with(*filenames, &block)
  filenames << '.env' if filenames.empty?

  filenames.inject({}) do |hash, filename|
    filename = File.expand_path filename
    hash.merge(block.call(filename) || {})
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.