Class: BottleDisableReason

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



69
70
71
72
73
74
75
# File 'formula_support.rb', line 69

def initialize(type, reason)
  @type = type
  @reason = reason
  # TODO: 3.3.0 should deprecate this behaviour as it was only needed for
  # Homebrew/core (where we don't want unneeded or disabled bottles any more)
  # odeprecated "bottle :#{@type}" if valid?
end

Instance Method Details

#to_sObject



85
86
87
88
89
# File 'formula_support.rb', line 85

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

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'formula_support.rb', line 77

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'formula_support.rb', line 81

def valid?
  SUPPORTED_TYPES.include? @type
end