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.



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

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

Instance Method Details

#to_sObject



96
97
98
99
100
# File 'formula_support.rb', line 96

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

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'formula_support.rb', line 88

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'formula_support.rb', line 92

def valid?
  SUPPORTED_TYPES.include? @type
end