Project

General

Profile

Actions

Feature #20293

closed

Add `Warning.categories` method that returns the warning category names

Added by nobu (Nobuyoshi Nakada) 2 months ago. Updated about 2 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:116909]

Description

I propose a new method Warning.categories.
This would be useful (or necessary) for tests mainly.

Currently, EnvUtil.capture_global_values saves the original warning settings as followings:

      @original_warning = defined?(Warning.[]) ? %i[deprecated experimental].to_h {|i| [i, Warning[i]]} : nil

But this is wrong now; performance is missing.
So we need:

      @original_warning = if defined?(Warning.[]) # 2.7+
        %i[deprecated experimental performance].to_h do |i|
          [i, begin Warning[i]; rescue ArgumentError; end]
        end.compact
      end

That means this list is version dependent and we will need to maintain this list in future.
We need another surefire way.

Actions #2

Updated by nobu (Nobuyoshi Nakada) about 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|1ad366134ded1667745dd9fa70919051869f8d6c.


[Feature #20293] Add Warning.categories

Actions

Also available in: Atom PDF

Like1
Like0Like0