Class: Homebrew::Cmd::Bundle::SubcommandContext Private

Inherits:
T::Struct
  • Object
show all
Defined in:
bundle/subcommand_context.rb

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subcommand:, global:, file: nil, no_upgrade:, verbose:, force:, jobs:, zap:, no_type_args:, extensions:) ⇒ void

Parameters:



# File ''

const :subcommand, String
const :global, T::Boolean
const :file, T.nilable(String)
const :no_upgrade, T::Boolean
const :verbose, T::Boolean
const :force, T::Boolean
const :jobs, Integer
const :zap, T::Boolean
const :no_type_args, T::Boolean
const :extensions, T::Array[T.class_of(Homebrew::Bundle::Extension)]

Instance Attribute Details

#extensionsArray<T.class_of(Homebrew::Bundle::Extension)> (readonly)

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.

Returns the value of prop extensions.

Returns:



# File ''

const :extensions, T::Array[T.class_of(Homebrew::Bundle::Extension)]

#fileString? (readonly)

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.

Returns the value of prop file.

Returns:



# File ''

const :file, T.nilable(String)

#forceBoolean (readonly)

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.

Returns the value of prop force.

Returns:

  • (Boolean)


# File ''

const :force, T::Boolean

#globalBoolean (readonly)

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.

Returns the value of prop global.

Returns:

  • (Boolean)


# File ''

const :global, T::Boolean

#jobsInteger (readonly)

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.

Returns the value of prop jobs.

Returns:



# File ''

const :jobs, Integer

#no_type_argsBoolean (readonly)

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.

Returns the value of prop no_type_args.

Returns:

  • (Boolean)


# File ''

const :no_type_args, T::Boolean

#no_upgradeBoolean (readonly)

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.

Returns the value of prop no_upgrade.

Returns:

  • (Boolean)


# File ''

const :no_upgrade, T::Boolean

#subcommandString (readonly)

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.

Returns the value of prop subcommand.

Returns:



# File ''

const :subcommand, String

#verboseBoolean (readonly)

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.

Returns the value of prop verbose.

Returns:

  • (Boolean)


# File ''

const :verbose, T::Boolean

#zapBoolean (readonly)

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.

Returns the value of prop zap.

Returns:

  • (Boolean)


# File ''

const :zap, T::Boolean

Instance Method Details

#extension_dump_disabled?(args, extension) ⇒ 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)


28
29
30
# File 'bundle/subcommand_context.rb', line 28

def extension_dump_disabled?(args, extension)
  args.public_send(extension.dump_disable_predicate_method)
end

#extension_selected?(args, extension) ⇒ 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)


23
24
25
# File 'bundle/subcommand_context.rb', line 23

def extension_selected?(args, extension)
  args.public_send(extension.predicate_method)
end

#selected_types(args) ⇒ Array<Symbol>

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:

  • args (T.untyped)

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'bundle/subcommand_context.rb', line 33

def selected_types(args)
  # We intentionally omit the s from `brews`, `casks`, and `taps` for ease of handling later.
  type_hash = {
    brew: args.formulae?,
    cask: args.casks?,
    tap:  args.taps?,
  }
  extensions.each do |extension|
    type_hash[extension.type] = extension_selected?(args, extension)
  end
  type_hash[:none] = no_type_args
  type_hash.select { |_, v| v }.keys
end