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 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



76
77
78
79
# File 'Library/Homebrew/formula_support.rb', line 76

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

Instance Method Details

#to_sObject



89
90
91
92
93
94
95
# File 'Library/Homebrew/formula_support.rb', line 89

def to_s
  if unneeded?
    "This formula doesn't require compiling."
  else
    @reason
  end
end

#unneeded?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'Library/Homebrew/formula_support.rb', line 81

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'Library/Homebrew/formula_support.rb', line 85

def valid?
  SUPPORTED_TYPES.include? @type
end