Module: Warnings Private
- Defined in:
- warnings.rb
Overview
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Helper module for handling warnings.
Class Method Summary collapse
- .fail_on(*warnings, &block) ⇒ void private
- .fatal?(message) ⇒ Boolean private
- .ignore(*warnings, &_block) ⇒ void private
- .ignored?(message) ⇒ Boolean private
Class Method Details
.fail_on(*warnings, &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.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'warnings.rb', line 48 def self.fail_on(*warnings, &block) warnings = (warnings) unless block @fatal_warnings = (@fatal_warnings + warnings).uniq return end previous_warnings = fatal_warnings Thread.current.thread_variable_set(FATAL_WARNINGS_KEY, previous_warnings + warnings) begin yield ensure Thread.current.thread_variable_set(FATAL_WARNINGS_KEY, previous_warnings) end end |
.fatal?(message) ⇒ 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.
70 71 72 73 |
# File 'warnings.rb', line 70 def self.fatal?() @fatal_warnings.any? { |warning| warning.match?() } || fatal_warnings.any? { |warning| warning.match?() } end |
.ignore(*warnings, &_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.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'warnings.rb', line 35 def self.ignore(*warnings, &_block) warnings = (warnings) previous_warnings = ignored_warnings Thread.current.thread_variable_set(IGNORED_WARNINGS_KEY, previous_warnings + warnings) begin yield ensure Thread.current.thread_variable_set(IGNORED_WARNINGS_KEY, previous_warnings) end end |
.ignored?(message) ⇒ 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.
65 66 67 |
# File 'warnings.rb', line 65 def self.ignored?() ignored_warnings.any? { |warning| warning.match?() } end |