Class: Cask::DSL::Caveats Private
- Defined in:
- cask/dsl/caveats.rb,
cask/dsl/caveats.rbi,
sorbet/rbi/dsl/cask/dsl/caveats.rbi
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Constant Summary collapse
- CONDITIONAL_CAVEATS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
Built-in caveats that have runtime conditions (arch, prefix, etc.) and should not be pre-serialized into the API JSON string.
T.let([:requires_rosetta, :files_in_usr_local].freeze, T::Array[Symbol])
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #discontinued? ⇒ Boolean private
- #eval_caveats(&block) ⇒ void private
- #initialize(*args) ⇒ void constructor private
- #invoked?(name) ⇒ Boolean private
- #kext ⇒ Symbol private
-
#puts(*args) ⇒ Symbol
private
Override
putsto collect caveats. -
#to_s_without_conditional ⇒ String
private
Returns caveats text excluding conditional built-in caveats.
Methods inherited from Base
#appdir, #arch, #caskroom_path, #language, #method_missing, #respond_to_missing?, #staged_path, #system_command, #token, #version
Constructor Details
#initialize(*args) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
21 22 23 24 25 26 27 |
# File 'cask/dsl/caveats.rb', line 21 def initialize(*args) super @built_in_caveats = T.let({}, T::Hash[T::Array[Symbol], String]) @custom_caveats = T.let([], T::Array[String]) @discontinued = T.let(false, T::Boolean) @invoked_caveats = T.let(Set.new, T::Set[Symbol]) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Cask::DSL::Base
Instance Method Details
#discontinued? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
42 |
# File 'cask/dsl/caveats.rb', line 42 def discontinued? = @discontinued |
#eval_caveats(&block) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
74 75 76 77 78 79 80 |
# File 'cask/dsl/caveats.rb', line 74 def eval_caveats(&block) result = instance_eval(&block) return unless result return if result == :built_in_caveat @custom_caveats << result.to_s.sub(/\s*\Z/, "\n") end |
#invoked?(name) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
62 63 64 |
# File 'cask/dsl/caveats.rb', line 62 def invoked?(name) @invoked_caveats.include?(name) end |
#kext ⇒ Symbol
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
5 |
# File 'cask/dsl/caveats.rbi', line 5 def kext; end |
#puts(*args) ⇒ Symbol
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Override puts to collect caveats.
68 69 70 71 |
# File 'cask/dsl/caveats.rb', line 68 def puts(*args) @custom_caveats += args :built_in_caveat end |
#to_s_without_conditional ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
Returns caveats text excluding conditional built-in caveats. Used when serializing caveats for the JSON API so that conditional caveats (like requires_rosetta) are not pre-baked into the string.
53 54 55 56 57 58 59 |
# File 'cask/dsl/caveats.rb', line 53 def to_s_without_conditional unconditional = @built_in_caveats.reject do |key, _| name = key.first name && CONDITIONAL_CAVEATS.include?(name) end (@custom_caveats + unconditional.values).join("\n") end |