Module: Kernel Private
- Included in:
- Cask::DSL::DependsOn, Dependencies, DependenciesHelpers, Homebrew::TestBot, Ignorable, OS::Mac::Cask::Quarantine::ClassMethods, Requirements, Utils::AST
- Defined in:
- extend/kernel.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Homebrew extends Ruby's Kernel with its public convenience methods.
Instance Method Summary collapse
-
#which(cmd, path = ENV.fetch("PATH")) ⇒ Pathname?
Find a command.
-
#with_env(hash, &block) ⇒ T.type_parameter(:U)
Calls the given block with the passed environment variables added to
ENV, then restoresENVafterwards.
Instance Method Details
#which(cmd, path = ENV.fetch("PATH")) ⇒ Pathname?
Find a command.
Keep in sync with which in Library/Homebrew/utils.sh.
13 14 15 |
# File 'extend/kernel.rb', line 13 def which(cmd, path = ENV.fetch("PATH")) Utils::Shell.which(cmd, path) end |
#with_env(hash, &block) ⇒ T.type_parameter(:U)
Note:
This method is not thread-safe – other threads which happen to be scheduled during the block will also see these environment variables.
Calls the given block with the passed environment variables
added to ENV, then restores ENV afterwards.
32 33 34 |
# File 'extend/kernel.rb', line 32 def with_env(hash, &block) Utils::Shell.with_env(hash, &block) end |