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.


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

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

Instance Method Details

#to_sObject


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

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

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)

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

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)

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

def valid?
  SUPPORTED_TYPES.include? @type
end