Module: Warnings Private

Defined in:
brew/Library/Homebrew/warnings.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper module for handling warnings.

Constant Summary collapse

COMMON_WARNINGS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  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

Class Method Summary collapse

Class Method Details

.ignore(*warnings) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'brew/Library/Homebrew/warnings.rb', line 20

def ignore(*warnings)
  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?

  result = yield
  Warning.clear
  result
end