Method: Autobuild::Environment#inherit

Defined in:
lib/autobuild/environment.rb

#inherit(*names) ⇒ Boolean

Declare that the given environment variable must not be reset by the env.sh script, but that new values should simply be prepended to it.

Returns:

  • (Boolean)

    true if environment inheritance is globally enabled and false otherwise. This is controlled by Autobuild.env_inherit=

See Also:



248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# File 'lib/autobuild/environment.rb', line 248

def inherit(*names)
    flag =
        if !names.last.respond_to?(:to_str)
            names.pop
        else
            true
        end

    if flag
        @inherited_variables |= names
        names.each do |env_name|
            @environment[env_name] ||= []
            init_from_env(env_name)
        end
    else
        names.each do |n|
            if @inherited_variables.include?(n)
                @inherited_variables.delete(n)
                init_from_env(n)
            end
        end
    end

    @inherit
end