Sha256: 214c04e7da455a3a621388ee5878a5ec9c42c89fe1e9925d21609c4b73e3eb68
Contents?: true
Size: 572 Bytes
Versions: 32
Compression:
Stored size: 572 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 = false) @filename = filename load(is_load) end def load(is_load = false) 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
32 entries across 32 versions & 6 rubygems