D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
ruby34
/
share
/
ri
/
system
/
Warning
/
Filename :
cdesc-Warning.ri
back
Copy
U:RDoc::NormalModule[iI"Warning:ET@0o:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I"FThe Warning module contains a single method named #warn, and the ;TI";module extends itself, making Warning.warn available. ;TI"=Warning.warn is called for all warnings issued by Ruby. ;TI"1By default, warnings are printed to $stderr.;To:RDoc::Markup::BlankLine o; ;[I"SChanging the behavior of Warning.warn is useful to customize how warnings are ;TI"Qhandled by Ruby, for instance by filtering some warnings, and/or outputting ;TI"4warnings somewhere other than <tt>$stderr</tt>.;T@o; ;[I"GIf you want to change the behavior of Warning.warn you should use ;TI"P<tt>Warning.extend(MyNewModuleWithWarnMethod)</tt> and you can use +super+ ;TI"Mto get the default behavior of printing the warning to <tt>$stderr</tt>.;T@o; ;[I" Example:;To:RDoc::Markup::Verbatim;[I"module MyWarningFilter ;TI"2 def warn(message, category: nil, **kwargs) ;TI"< if /some warning I want to ignore/.match?(message) ;TI" # ignore ;TI" else ;TI" super ;TI" end ;TI" end ;TI" end ;TI"$Warning.extend MyWarningFilter ;T:@format0o; ;[I"PYou should never redefine Warning#warn (the instance method), as that will ;TI">then no longer provide a way to use the default behavior.;T@o; ;[I"kThe warning[https://rubygems.org/gems/warning] gem provides convenient ways to customize Warning.warn.;T: @fileI"error.c;T:0@omit_headings_from_table_of_contents_below0; 0;0[ [ [ [[I" class;T[[:public[[I"[];TI"error.c;T[I"[]=;T@?[I"categories;T@?[:protected[ [:private[ [I" instance;T[[;[[I" warn;T@?[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[@3@3cRDoc::TopLevel