Module: Aruba::Api::Environment
- Included in:
- Aruba::Api
- Defined in:
- lib/aruba/api/environment.rb
Overview
Environment methods of aruba
Instance Method Summary collapse
-
#append_environment_variable(name, value) ⇒ Object
Append environment variable.
-
#delete_environment_variable(name) ⇒ Object
Remove existing environment variable.
-
#prepend_environment_variable(name, value) ⇒ Object
Prepend environment variable.
-
#set_environment_variable(name, value) ⇒ Object
Set environment variable.
Instance Method Details
#append_environment_variable(name, value) ⇒ Object
Append environment variable
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/aruba/api/environment.rb', line 36 def append_environment_variable(name, value) name = name.to_s value = value.to_s old_environment = aruba.environment.to_h aruba.environment.append name, value new_environment = aruba.environment.to_h aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => value }) self end |
#delete_environment_variable(name) ⇒ Object
Remove existing environment variable
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/aruba/api/environment.rb', line 76 def delete_environment_variable(name) name = name.to_s old_environment = aruba.environment.to_h aruba.environment.delete name new_environment = aruba.environment.to_h aruba.event_bus.notify Events::DeletedEnvironmentVariable.new(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => '' }) self end |
#prepend_environment_variable(name, value) ⇒ Object
Prepend environment variable
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/aruba/api/environment.rb', line 56 def prepend_environment_variable(name, value) name = name.to_s value = value.to_s old_environment = aruba.environment.to_h aruba.environment.prepend name, value new_environment = aruba.environment.to_h aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => value }) self end |
#set_environment_variable(name, value) ⇒ Object
Set environment variable
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/aruba/api/environment.rb', line 16 def set_environment_variable(name, value) name = name.to_s value = value.to_s old_environment = aruba.environment.to_h aruba.environment[name] = value new_environment = aruba.environment.to_h aruba.event_bus.notify Events::AddedEnvironmentVariable.new(:old => old_environment, :new => new_environment, :changed => { :name => name, :value => value }) self end |