Class: BottleDisableReason

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/formula_support.rb

Overview

Used to annotate formulae that don't require compiling or cannot build a bottle.

Constant Summary collapse

SUPPORTED_TYPES =
[:unneeded, :disable].freeze

Instance Method Summary collapse

Constructor Details

#initialize(type, reason) ⇒ BottleDisableReason

Returns a new instance of BottleDisableReason.


65
66
67
68
# File 'Library/Homebrew/formula_support.rb', line 65

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

Instance Method Details

#to_sObject


78
79
80
81
82
# File 'Library/Homebrew/formula_support.rb', line 78

def to_s
  return "This formula doesn't require compiling." if unneeded?

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)

70
71
72
# File 'Library/Homebrew/formula_support.rb', line 70

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)

74
75
76
# File 'Library/Homebrew/formula_support.rb', line 74

def valid?
  SUPPORTED_TYPES.include? @type
end