Class: KegOnlyReason Private

Inherits:
Object show all
Defined in:
extend/os/mac/keg_only_reason.rb,
keg_only_reason.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) ⇒ 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.

Parameters:



11
12
13
14
# File 'keg_only_reason.rb', line 11

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

Instance Attribute Details

#reasonSymbol, String (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:



8
9
10
# File 'keg_only_reason.rb', line 8

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/keg_only_reason.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)


32
33
34
# File 'keg_only_reason.rb', line 32

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)


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

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)


27
28
29
# File 'keg_only_reason.rb', line 27

def shadowed_by_macos?
  @reason == :shadowed_by_macos
end

#to_hashHash{String => String}

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:



67
68
69
70
71
72
73
74
75
76
77
78
# File 'keg_only_reason.rb', line 67

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 'keg_only_reason.rb', line 17

def versioned_formula?
  @reason == :versioned_formula
end