Class: BottleDisableReason

Inherits:
Object
  • Object
show all
Defined in:
brew/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



48
49
50
51
# File 'brew/Library/Homebrew/formula_support.rb', line 48

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

Instance Method Details

#to_sObject



61
62
63
64
65
# File 'brew/Library/Homebrew/formula_support.rb', line 61

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

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'brew/Library/Homebrew/formula_support.rb', line 53

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'brew/Library/Homebrew/formula_support.rb', line 57

def valid?
  SUPPORTED_TYPES.include? @type
end