Sha256: db393c2fc3405e20964e81c6787346a43e66c591324bc9b715369b4ea54ce927

Contents?: true

Size: 342 Bytes

Versions: 5

Compression:

Stored size: 342 Bytes

Contents

module Dotenv
  class Environment < Hash

    def initialize(filename)
      @filename = filename
      load
    end

    def load
      update Parser.call(read)
    end

    def read
      File.read(@filename)
    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

Version Path
dotenv-1.0.2 lib/dotenv/environment.rb
dotenv-1.0.1 lib/dotenv/environment.rb
dotenv-1.0.0 lib/dotenv/environment.rb
dotenv-0.11.1 lib/dotenv/environment.rb
dotenv-0.11.0 lib/dotenv/environment.rb