Module: Aruba::Api::Environment
- Included in:
- Aruba::Api, Bundler
- Defined in:
- lib/aruba/api/environment.rb
Overview
Environment methods of aruba
Instance Method Summary collapse
-
#append_environment_variable(name, value) ⇒ self
Append environment variable.
-
#delete_environment_variable(name) ⇒ self
Remove existing environment variable.
-
#prepend_environment_variable(name, value) ⇒ self
Prepend environment variable.
-
#set_environment_variable(name, value) ⇒ self
Set environment variable.
Instance Method Details
#append_environment_variable(name, value) ⇒ self
Append environment variable
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/aruba/api/environment.rb', line 43 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 environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: value } } aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change) self end |
#delete_environment_variable(name) ⇒ self
Remove existing environment variable
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/aruba/api/environment.rb', line 90 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 environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: "" } } aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change) self end |
#prepend_environment_variable(name, value) ⇒ self
Prepend environment variable
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/aruba/api/environment.rb', line 68 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 environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: value } } aruba.event_bus.notify Events::ChangedEnvironmentVariable.new(environment_change) self end |
#set_environment_variable(name, value) ⇒ self
Set environment variable
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/aruba/api/environment.rb', line 18 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 environment_change = { old: old_environment, new: new_environment, changed: { name: name, value: value } } aruba.event_bus.notify Events::AddedEnvironmentVariable.new(environment_change) self end |