/usr/lib/ruby/vendor_ruby/aruba/api/environment.rb is in ruby-aruba 0.14.2-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | require 'aruba/platform'
# Aruba
module Aruba
# Api
module Api
# Environment methods of aruba
module Environment
# Set environment variable
#
# @param [String] name
# The name of the environment variable as string, e.g. 'HOME'
#
# @param [String] value
# The value of the environment variable. Needs to be a string.
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
# Append environment variable
#
# @param [String] name
# The name of the environment variable as string, e.g. 'HOME'
#
# @param [String] value
# The value of the environment variable. Needs to be a string.
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
# Prepend environment variable
#
# @param [String] name
# The name of the environment variable as string, e.g. 'HOME'
#
# @param [String] value
# The value of the environment variable. Needs to be a string.
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
# Remove existing environment variable
#
# @param [String] key
# The name of the environment variable as string, e.g. 'HOME'
#
# @param [String] value
# The value of the environment variable. Needs to be a string.
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
end
end
end
|