Class StructuredWarnings::Base
In: lib/structured_warnings/base.rb
Parent: Object

Descendents of class StructuredWarnings::Base are used to raise structured warnings. They enable programmers to explicitly supress certain kinds of warnings and provide additional information in contrast to the plain warn method. They implement an Exception-like interface and carry information about the warning — its type (the warning‘s class name), an optional descriptive string, and optional traceback information. Programs may subclass StructuredWarnings::Base to add additional information.

Large portions of this class‘s documentation are taken from the Exception RDoc.

Methods

backtrace   inspect   message   new   set_backtrace   to_s   to_str  

Classes and Modules

Module StructuredWarnings::Base::ClassMethods

Public Class methods

Construct a new StructuredWarning::Base object, optionally passing in a message.

Public Instance methods

Returns any backtrace associated with the warning. The backtrace is an array of strings, each containing either ``filename:lineNo: in `method’’’ or ``filename:lineNo.’‘

Return this warning‘s class name and message

message()

Alias for to_s

Sets the backtrace information associated with warning. The argument must be an array of String objects in the format described in Exception#backtrace.

Returns warning‘s message (or the name of the warning if no message is set).

to_str()

Alias for to_s

[Validate]