Sha256: 439742ea38409af98e1c073121c1d609b60ae4e57afb979a8e93c32b6e89aed2
Contents?: true
Size: 520 Bytes
Versions: 5
Compression:
Stored size: 520 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) @filename = filename load end def load update Parser.call(read) 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
5 entries across 5 versions & 1 rubygems