Class: Dotenv::Environment

### Home Classes Methods

### In Files

- lib/dotenv/environment.rb

### Parent

Hash

### Methods

- ::new
- #apply
- #apply!
- #load
- #read

### Class/Module Index

Quicksearch

- Dotenv
- Dotenv::CLI
- Dotenv::Environment
- Dotenv::FormatError
- Dotenv::Parser
- Dotenv::Substitutions
- Dotenv::Substitutions::Command
- Dotenv::Substitutions::Variable

No matching classes.

# Dotenv::Environment

This class inherits from Hash and represents the environemnt into which Dotenv will load key value pairs from a file.

### Attributes

filename[R]

### Public Class Methods

new(filename) click to toggle source

    # File lib/dotenv/environment.rb, line 7
    def initialize(filename)
      @filename = filename
      load
    end

### Public Instance Methods

apply() click to toggle source

    # File lib/dotenv/environment.rb, line 20
    def apply
      each { |k, v| ENV[k] ||= v }
    end

apply!() click to toggle source

    # File lib/dotenv/environment.rb, line 24
    def apply!
      each { |k, v| ENV[k] = v }
    end

load() click to toggle source

    # File lib/dotenv/environment.rb, line 12
    def load
      update Parser.call(read)
    end

read() click to toggle source

    # File lib/dotenv/environment.rb, line 16
    def read
      File.read(@filename)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.