Module: Dependable Private

Included in:
Dependency, Requirement
Defined in:
dependable.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.

Shared functions for classes which can be depended upon.

Constant Summary collapse

RESERVED_TAGS =

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

:run and :linked are no longer used but keep them here to avoid their misuse in future.

[:build, :optional, :recommended, :run, :test, :linked, :implicit].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tagsObject (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.



12
13
14
# File 'dependable.rb', line 12

def tags
  @tags
end

Instance Method Details

#build?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.

Returns:

  • (Boolean)


14
15
16
# File 'dependable.rb', line 14

def build?
  tags.include? :build
end

#implicit?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.

Returns:

  • (Boolean)


30
31
32
# File 'dependable.rb', line 30

def implicit?
  tags.include? :implicit
end

#option_tagsObject

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.



38
39
40
# File 'dependable.rb', line 38

def option_tags
  tags - RESERVED_TAGS
end

#optional?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.

Returns:

  • (Boolean)


18
19
20
# File 'dependable.rb', line 18

def optional?
  tags.include? :optional
end

#optionsObject

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.



42
43
44
# File 'dependable.rb', line 42

def options
  Options.create(option_tags)
end

#prune_from_option?(build) ⇒ 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.

Returns:

  • (Boolean)


46
47
48
49
50
# File 'dependable.rb', line 46

def prune_from_option?(build)
  return false if !optional? && !recommended?

  build.without?(self)
end

#prune_if_build_and_not_dependent?(dependent, formula = nil) ⇒ 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.

Returns:

  • (Boolean)


52
53
54
55
56
57
# File 'dependable.rb', line 52

def prune_if_build_and_not_dependent?(dependent, formula = nil)
  return false unless build?
  return dependent.installed? unless formula

  dependent != formula
end

#recommended?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.

Returns:

  • (Boolean)


22
23
24
# File 'dependable.rb', line 22

def recommended?
  tags.include? :recommended
end

#required?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.

Returns:

  • (Boolean)


34
35
36
# File 'dependable.rb', line 34

def required?
  !build? && !test? && !optional? && !recommended?
end

#test?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.

Returns:

  • (Boolean)


26
27
28
# File 'dependable.rb', line 26

def test?
  tags.include? :test
end