Method: Kernel#warn

Defined in:
error.c

#warn(msg, ...) ⇒ nil

Displays each of the given messages followed by a record separator on STDERR unless warnings have been disabled (for example with the -W0 flag).

  warn("warning 1", "warning 2")

<em>produces:</em>

  warning 1
  warning 2

Returns:

  • (nil)


258
259
260
261
262
263
264
265
# File 'error.c', line 258

static VALUE
rb_warn_m(int argc, VALUE *argv, VALUE exc)
{
    if (!NIL_P(ruby_verbose) && argc > 0) {
	rb_io_puts(argc, argv, rb_stderr);
    }
    return Qnil;
}