class Aruba::Platforms::UnixEnvironmentVariables::UpdateAction

Update environment

Attributes

block[R]
other_env[R]

Public Class Methods

new(other_env, &block) click to toggle source
# File lib/aruba/platforms/unix_environment_variables.rb, line 11
def initialize(other_env, &block)
  @other_env = other_env

  @other_env = if RUBY_VERSION <= '1.9.3'
                 # rubocop:disable Style/EachWithObject
                 @other_env.to_hash.inject({}) { |a, (k, v)| a[k] = v.to_s; a }
                 # rubocop:enable Style/EachWithObject
               else
                 @other_env.to_h.each_with_object({}) { |(k, v), a| a[k] = v.to_s }
               end

  @block = if block_given?
             block
           end
end

Public Instance Methods

call(env) click to toggle source
# File lib/aruba/platforms/unix_environment_variables.rb, line 27
def call(env)
  if block
    env.update(other_env, &block)
  else
    env.update(other_env)
  end
end