Class: Aruba::Platforms::UnixEnvironmentVariables::UpdateAction

Inherits:
Object
  • Object
show all
Defined in:
lib/aruba/platforms/unix_environment_variables.rb

Overview

Update environment

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(other_env, &block) ⇒ UpdateAction

Returns a new instance of UpdateAction.



11
12
13
14
15
# File 'lib/aruba/platforms/unix_environment_variables.rb', line 11

def initialize(other_env, &block)
  @other_env = other_env.to_h.transform_values(&:to_s)

  @block = block
end

Instance Attribute Details

#blockObject (readonly)

Returns the value of attribute block.



9
10
11
# File 'lib/aruba/platforms/unix_environment_variables.rb', line 9

def block
  @block
end

#other_envObject (readonly)

Returns the value of attribute other_env.



9
10
11
# File 'lib/aruba/platforms/unix_environment_variables.rb', line 9

def other_env
  @other_env
end

Instance Method Details

#call(env) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/aruba/platforms/unix_environment_variables.rb', line 17

def call(env)
  if block
    env.update(other_env, &block)
  else
    env.update(other_env)
  end
end