Tbpgr Blog

Employee Experience Engineer tbpgr(てぃーびー) のブログ

Ruby | Kernel | warn

概要

Kernel#warn(*message) -> nil

詳細

message を 標準エラー出力 $stderr に出力します。
$VERBOSE フラグ が nil のときは何も出力しません。
文字列以外のオブジェクトは to_s してから出力する。

サンプルコード
$VERBOSE = nil
warn('warning1')
$VERBOSE = true
warn('warning2')

出力

warning2