Class: Cloudenv::Environment
- Inherits:
-
Hash
- Object
- Hash
- Cloudenv::Environment
- Defined in:
- lib/cloudenv/environment.rb
Instance Method Summary collapse
- #apply ⇒ Object
- #apply! ⇒ Object
-
#initialize(variables) ⇒ Environment
constructor
A new instance of Environment.
- #load(variables) ⇒ Object
Constructor Details
#initialize(variables) ⇒ Environment
Returns a new instance of Environment.
3 4 5 |
# File 'lib/cloudenv/environment.rb', line 3 def initialize(variables) load(variables) end |
Instance Method Details
#apply ⇒ Object
13 14 15 |
# File 'lib/cloudenv/environment.rb', line 13 def apply each { |k, v| ENV[k] ||= v } end |
#apply! ⇒ Object
17 18 19 |
# File 'lib/cloudenv/environment.rb', line 17 def apply! each { |k, v| ENV[k] = v } end |
#load(variables) ⇒ Object
7 8 9 10 11 |
# File 'lib/cloudenv/environment.rb', line 7 def load(variables) variables.each do |variable| self[variable['key']] = variable['value'] end end |