Skip to content

Commit 53c8e4e

Browse files
committed
Add Warning.categories
1 parent 50a15f6 commit 53c8e4e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

core/warning.rbs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,14 @@ module Warning
6666
#
6767
def self.[]=: [T] (category, T flag) -> T
6868

69+
# <!--
70+
# rdoc-file=error.c
71+
# - categories -> array
72+
# -->
73+
# Returns a list of the supported category symbols.
74+
#
75+
def self.categories: () -> Array[Symbol]
76+
6977
# <!--
7078
# rdoc-file=error.c
7179
# - warn(msg, category: nil) -> nil

test/stdlib/Warning_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ def test_aset
3333
refute_send_type "(_ToSym, Rational) -> Rational",
3434
Warning, :[]=, ToSym.new(WARNING_CATEGORIES.first), 1r
3535
end
36+
37+
def test_categories
38+
if_ruby("3.4"...) do
39+
assert_send_type "() -> Array[Symbol]",
40+
Warning, :categories
41+
end
42+
end
3643
end
3744

3845
class WarningTest < Test::Unit::TestCase

0 commit comments

Comments
 (0)