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.
Constant Summary collapse
- COMMON_WARNINGS =
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.
T.let({ parser_syntax: [ %r{warning: parser/current is loading parser/ruby\d+, which recognizes}, /warning: \d+\.\d+\.\d+-compliant syntax, but you are running \d+\.\d+\.\d+\./, %r{warning: please see https://github\.com/whitequark/parser#compatibility-with-ruby-mri\.}, ], }.freeze, T::Hash[Symbol, T::Array[Regexp]])
Class Method Summary collapse
Class Method Details
.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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'warnings.rb', line 17 def self.ignore(*warnings, &_block) warnings.map! do |warning| next warning if !warning.is_a?(Symbol) || !COMMON_WARNINGS.key?(warning) COMMON_WARNINGS[warning] end warnings.flatten.each do |warning| Warning.ignore warning end return unless block_given? yield Warning.clear end |