Skip to content
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.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0