Class: Dotenv::Environment
- Inherits:
-
Hash
- Object
- Hash
- Dotenv::Environment
- Defined in:
- lib/dotenv/environment.rb
Instance Method Summary collapse
- #apply ⇒ Object
- #apply! ⇒ Object
-
#initialize(filename) ⇒ Environment
constructor
A new instance of Environment.
- #load ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(filename) ⇒ Environment
Returns a new instance of Environment.
4 5 6 7 |
# File 'lib/dotenv/environment.rb', line 4 def initialize(filename) @filename = filename load end |
Instance Method Details
#apply ⇒ Object
17 18 19 |
# File 'lib/dotenv/environment.rb', line 17 def apply each { |k,v| ENV[k] ||= v } end |
#apply! ⇒ Object
21 22 23 |
# File 'lib/dotenv/environment.rb', line 21 def apply! each { |k,v| ENV[k] = v } end |
#load ⇒ Object
9 10 11 |
# File 'lib/dotenv/environment.rb', line 9 def load update Parser.call(read) end |
#read ⇒ Object
13 14 15 |
# File 'lib/dotenv/environment.rb', line 13 def read File.read(@filename) end |