Env
Kanrisuru::Remote::Env
helps manage remote envionment variables that are passed along on the command line.
Public Class Methods
new
Instantiates a new instance of the Kanrisuru::Remote::Env
class.
env = Kanrisuru::Remote::Env.new
env['VAR1'] = 'hello'
env.to_s
"export VAR1=hello;"
Public Instance Methods
[]
Access a single environment variable.
env['VAR1']
'hello'
[]=
Set an environment variable.
env['VAR2'] = 'world'
to_h
Return the environment variables as a hash
env.to_h
{'VAR1' => 'hello', 'VAR2' => 'world'}
clear
Resets the environment variables.
env.clear
env.count
0
to_s
Prepares the environment variables as command line options
env = Kanrisuru::Remote::Env.new
env['VAR1'] = 'foo'
env['VAR2'] = 'bar'
env['VAR3'] = 'baz'
env.to_s
"export VAR1=foo; VAR2=bar; VAR3=baz;"
count
Get the number of environment variables set
env = Kanrisuru::Remote::Env.new
env['VAR1'] = 'foo'
env['VAR2'] = 'bar'
env['VAR3'] = 'baz'
env.count
3
delete
Remove an environment variable.
env.delete('VAR2')
env.count
2