Sha256: 2eda9ed6725e8acfd17ace6eb77b1ecbe3246b139c6aefc3f6753ac1133c3b02
Contents?: true
Size: 409 Bytes
Versions: 1
Compression:
Stored size: 409 Bytes
Contents
module Dotenv class Environment < Hash def initialize(filename) @filename = filename load if File.exists? @filename end def load read.each do |line| self[$1] = $2 || $3 if line =~ /\A(\w+)(?:=|: ?)(?:'([^']*)'|([^']*))\z/ end end def read File.read(@filename).split("\n") end def apply each { |k,v| ENV[k] ||= v } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dotenv-0.5.0 | lib/dotenv/environment.rb |