Spec-Zone.ru › Homebrew

Module: BuildEnvironment::DSL Private

Included in:
Formula, Requirement
Defined in:
build_environment.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.

DSL for specifying build environment settings.

Instance Method Summary collapse

  • #env(*settings) ⇒ BuildEnvironment? private
  • #inherited(child) ⇒ void private

    Initialise @env for each class which may use this DSL (e.g. each formula subclass).

Instance Method Details

#env(*settings) ⇒ BuildEnvironment?

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:

  • settings (Symbol)

Returns:

  • (BuildEnvironment, nil)


41
42
43
44
45
46
# File 'build_environment.rb', line 41

def env(*settings)
  env = @env
  Kernel.raise ArgumentError, "#{self} has not been initialized with a BuildEnvironment" if env.nil?

  env.merge(settings)
end

#inherited(child) ⇒ void

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.

This method returns an undefined value.

Initialise @env for each class which may use this DSL (e.g. each formula subclass). env may never be called and it needs to be initialised before the class is frozen.

Parameters:

  • child (T.untyped)


33
34
35
36
37
38
# File 'build_environment.rb', line 33

def inherited(child)
  super
  child.instance_eval do
    @env = T.let(BuildEnvironment.new, T.nilable(BuildEnvironment))
  end
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/BuildEnvironment/DSL.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API