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
# File 'formula_support.rb', line 69

def initialize(type, reason)
  @type = type
  @reason = reason
  odeprecated "bottle :#{@type}" if valid?
end

Instance Method Details

#to_sObject



83
84
85
86
87
# File 'formula_support.rb', line 83

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

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)


75
76
77
# File 'formula_support.rb', line 75

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'formula_support.rb', line 79

def valid?
  SUPPORTED_TYPES.include? @type
end