Sha256: ea6c3f4d30eaac4a714fe1c1229adad19d553b414fe07656152e999c1b573f52
Contents?: true
Size: 755 Bytes
Versions: 2
Compression:
Stored size: 755 Bytes
Contents
require 'dotenv/parser' require 'dotenv/environment' module Dotenv def self.load(*filenames) with(*filenames) { |f| Environment.new(f).apply if File.exists?(f) } end # same as `load`, but raises Errno::ENOENT if any files don't exist def self.load!(*filenames) with(*filenames) { |f| Environment.new(f).apply } end # same as `load`, but will override existing values in `ENV` def self.overload(*filenames) with(*filenames) { |f| Environment.new(f).apply! if File.exists?(f) } end protected 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 end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dotenv-0.11.1 | lib/dotenv.rb |
dotenv-0.11.0 | lib/dotenv.rb |