Class: KegOnlyReason Private

Inherits:
Object show all
Defined in:
extend/os/mac/formula_support.rb,
formula_support.rb

Overview

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.

Used to annotate formulae that duplicate macOS-provided software or cause conflicts when linked in.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reason, explanation) ⇒ KegOnlyReason

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 a new instance of KegOnlyReason.



12
13
14
15
# File 'formula_support.rb', line 12

def initialize(reason, explanation)
  @reason = reason
  @explanation = explanation
end

Instance Attribute Details

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



10
11
12
# File 'formula_support.rb', line 10

def reason
  @reason
end

Instance Method Details

#applicable?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)


6
7
8
# File 'extend/os/mac/formula_support.rb', line 6

def applicable?
  true
end

#by_macos?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)


29
30
31
# File 'formula_support.rb', line 29

def by_macos?
  provided_by_macos? || shadowed_by_macos?
end

#provided_by_macos?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)


21
22
23
# File 'formula_support.rb', line 21

def provided_by_macos?
  @reason == :provided_by_macos
end

#shadowed_by_macos?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)


25
26
27
# File 'formula_support.rb', line 25

def shadowed_by_macos?
  @reason == :shadowed_by_macos
end

#to_hashObject

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.



63
64
65
66
67
68
69
70
71
72
73
74
# File 'formula_support.rb', line 63

def to_hash
  reason_string = if @reason.is_a?(Symbol)
    @reason.inspect
  else
    @reason.to_s
  end

  {
    "reason"      => reason_string,
    "explanation" => @explanation,
  }
end

#versioned_formula?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)


17
18
19
# File 'formula_support.rb', line 17

def versioned_formula?
  @reason == :versioned_formula
end