Repository navigation
Add the Warning module - #458
Merged
Merged
Conversation
Warning was an uninitialized constant. It is now defined in the prelude as the
module Ruby routes warnings through:
- Warning.[](category) / Warning.[]=(category, flag) read and toggle whether a
category's warnings are enabled — :deprecated (false), :experimental (true),
:performance (false) and :strict_unused_block (false) by default. A non-Symbol
category raises TypeError and an unknown one ArgumentError.
- Warning.categories lists the known categories.
- Warning.warn writes its message to $stderr unchanged and returns nil; it is a
module function (extend self) owned by Warning, so a program can override it
by redefining Warning.warn.
Verified against ruby 4.0.6. Full package coverage stays at 100.0% (the frozen
prelude was regenerated). Zero-regression rubyspec sweep; core/warning/
{element_reference +2, element_set +3, warn +3, categories +1}. (The remaining
warn_spec examples require Kernel#warn to route through Warning.warn and the
parser to emit through it — separate follow-ups — or use ruby_exe subprocesses
the harness skips.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Warningwas an uninitialized constant. It is now defined in the prelude as themodule Ruby routes warnings through:
Warning.[](category)/Warning.[]=(category, flag)read and toggle whether acategory's warnings are enabled —
:deprecated(false),:experimental(true),:performance(false) and:strict_unused_block(false) by default. Anon-Symbol category raises
TypeErrorand an unknown oneArgumentError.Warning.categorieslists the known categories.Warning.warnwrites its message to$stderrunchanged and returns nil; it isa module function (
extend self) owned byWarning, so a program can overrideit by redefining
Warning.warn.Verified against ruby 4.0.6. Full package coverage stays at 100.0% (the
frozen prelude was regenerated). Zero-regression rubyspec sweep;
core/warning/{element_reference+2,element_set+3,warn+3,categories+1}. (The remainingwarn_specexamples requireKernel#warntoroute through
Warning.warnand the parser to emit through it — separatefollow-ups — or use
ruby_exesubprocesses the harness skips.)🤖 Generated with Claude Code