Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Warning#warn

(::String message, ?category: ::Warning::category?) -> nil
warn(msg, category: nil) → nil

Writes warning message msg to $stderr. This method is called by Ruby for all emitted warnings. A category may be included with the warning.

See the documentation of the Warning module for how to customize this.

Ruby version changes

  1. 3.0
See also .categories .[]= also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0