Sha256: 48e4564c1ba0163c84dbce5530bdd2f750660e43dadb99f3e15ce1755a2baed5
Contents?: true
Size: 556 Bytes
Versions: 2
Compression:
Stored size: 556 Bytes
Contents
module Dotenv # This class inherits from Hash and represents the environment into which # Dotenv will load key value pairs from a file. class Environment < Hash attr_reader :filename def initialize(filename, is_load) @filename = filename load(is_load) end def load(is_load) update Parser.call(read, is_load) end def read File.open(@filename, "rb:bom|utf-8", &:read) end def apply each { |k, v| ENV[k] ||= v } end def apply! each { |k, v| ENV[k] = v } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dotenv-2.4.0 | lib/dotenv/environment.rb |
dotenv-2.3.0 | lib/dotenv/environment.rb |