Module: Utils::Ruby Private

Defined in:
utils/ruby.rb

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.

Class Method Summary collapse

Class Method Details

.require?(path) ⇒ Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'utils/ruby.rb', line 9

def require?(path)
  return false if path.nil?

  if defined?(Warnings)
    Warnings.ignore(/already initialized constant/, /previous definition of/) do
      Kernel.require path.to_s
    end
  else
    Kernel.require path.to_s
  end
  true
rescue LoadError
  false
end