Sha256: c0c88c66c6209c3ee001c69a0107f0d4bbf0fff75f7fda4f26658e59474a08c1
Contents?: true
Size: 605 Bytes
Versions: 1
Compression:
Stored size: 605 Bytes
Contents
require 'dotenv/environment' module Dotenv def self.load(*filenames) default_if_empty(filenames).inject({}) do |hash, filename| hash.merge(File.exists?(filename) ? Environment.new(filename).apply : {}) end end # same as `load`, but raises Errno::ENOENT if any files don't exist def self.load!(*filenames) load( *default_if_empty(filenames).each do |filename| raise(Errno::ENOENT.new(filename)) unless File.exists?(filename) end ) end protected def self.default_if_empty(filenames) filenames.empty? ? (filenames << '.env') : filenames end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dotenv-0.7.0 | lib/dotenv.rb |