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

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

Instance Method Details

#to_sObject



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

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

  @reason
end

#unneeded?Boolean

Returns:

  • (Boolean)


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

def unneeded?
  @type == :unneeded
end

#valid?Boolean

Returns:

  • (Boolean)


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

def valid?
  SUPPORTED_TYPES.include? @type
end