summaryrefslogtreecommitdiff
path: root/NEWS.md
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2020-08-06 13:25:11 -0400
committerJeremy Evans <code@jeremyevans.net>2020-09-01 16:16:06 -0700
commit6e8ec9ab6da228ade70fe7d0dd16540d8f859f00 (patch)
tree779940e5bde3daddcd0f9fc6ac91fa509b64e1d6 /NEWS.md
parentde10a1f3583adeeffd7f8bcf8f276e0a626ffa0c (diff)
Support passing a category to `Warning.warn`
This change adds a `category` kwarg to make it easier to monkey patch `Warning.warn`. Warnings already have a category, but that warning isn't exposed. This implements a way to get the category so that warnings with a specific category, like deprecated, can be treated differently than other warnings in an application. The change here does an arity check on the method to support backwards compatibility for applications that may already have a warning monkey patch. For our usecase we want to `raise` for deprecation warnings in order to get the behavior for the next Ruby version. For example, now that we fixed all our warnings and deployed Ruby 2.7 to production, we want to be able to have deprecation warnings behave like they would in 3.0: raise an error. For other warnings, like uninialized constants, that behavior won't be removed from Ruby in the next version, so we don't need to raise errors. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3418
Diffstat (limited to 'NEWS.md')
-rw-r--r--NEWS.md8
1 files changed, 8 insertions, 0 deletions
diff --git a/NEWS.md b/NEWS.md
index 075c5ec8b9..1bc19e83e1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -165,6 +165,13 @@ Outstanding ones only.
* Symbol#to_proc now returns a lambda Proc.
[[Feature #16260]]
+* Warning
+
+ * Modified method
+
+ * Warning#warn now supports a category kwarg.
+ [[Feature #17122]]
+
## Stdlib updates
Outstanding ones only.
@@ -342,3 +349,4 @@ Excluding feature bug fixes.
[Feature #16686]: https://bugs.ruby-lang.org/issues/16686
[Misc #16961]: https://bugs.ruby-lang.org/issues/16961
[Bug #8446]: https://bugs.ruby-lang.org/issues/8446
+[Feature #17122]: https://bugs.ruby-lang.org/issues/17122