From 799ac5b1b27fee497dd3b9f133cbef33058811e4 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 29 Dec 2003 03:56:22 +0000 Subject: Add RDoc for Kernel global functions, tidy array and error git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@5343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index 3f48c85c6..dcf76d89b 100644 --- a/error.c +++ b/error.c @@ -162,6 +162,14 @@ rb_warning(fmt, va_alist) va_end(args); } +/* + * call-seq: + * warn(msg) => nil + * + * Display the given message (followed by a newline) on STDERR unless + * warnings are disabled (for example with the -W0 flag). + */ + static VALUE rb_warn_m(self, mesg) VALUE self, mesg; @@ -517,6 +525,13 @@ exc_set_backtrace(exc, bt) return rb_iv_set(exc, "bt", check_backtrace(bt)); } +/* + * call-seq: + * SystemExit.new(status=0) => system_exit + * + * Create a new +SystemExit+ exception with the given status. + */ + static VALUE exit_initialize(argc, argv, exc) int argc; @@ -533,6 +548,15 @@ exit_initialize(argc, argv, exc) return exc; } + +/* + * call-seq: + * system_exit.status => fixnum + * + * Return the status value associated with this system exit. + */ + + static VALUE exit_status(exc) VALUE exc; @@ -564,6 +588,15 @@ rb_name_error(id, fmt, va_alist) rb_exc_raise(exc); } +/* + * call-seq: + * NameError.new(msg [, name]) => name_error + * + * Construct a new NameError exception. If given the name + * parameter may subsequently be examined using the NameError.name + * method. + */ + static VALUE name_err_initialize(argc, argv, self) int argc; @@ -578,6 +611,13 @@ name_err_initialize(argc, argv, self) return self; } +/* + * call-seq: + * name_error.name => string or nil + * + * Return the name associated with this NameError exception. + */ + static VALUE name_err_name(self) VALUE self; @@ -585,6 +625,16 @@ name_err_name(self) return rb_attr_get(self, rb_intern("name")); } +/* + * call-seq: + * NoMethodError.new(msg, name [, args]) => no_method_error + * + * Contruct a NoMethodError exception for a method of the given name + * called with the given arguments. The name may be accessed using + * the #name method on the resulting object, and the + * arguments using the #args method. + */ + static VALUE nometh_err_initialize(argc, argv, self) int argc; @@ -597,6 +647,14 @@ nometh_err_initialize(argc, argv, self) return self; } +/* + * call-seq: + * no_method_error.args => obj + * + * Return the arguments passed in as the third parameter to + * the constructor. + */ + static VALUE nometh_err_args(self) VALUE self; @@ -679,6 +737,17 @@ get_syserr(n) return error; } +/* + * call-seq: + * SystemCallError.new(msg, errno) => system_call_error_subclass + * + * If _errno_ corresponds to a known system error code, constructs + * the appropriate Errno class for that error, otherwise + * constructs a generic SystemCallError object. The + * error number is subsequently available via the errno + * method. + */ + static VALUE syserr_initialize(argc, argv, self) int argc; @@ -726,6 +795,13 @@ syserr_initialize(argc, argv, self) return self; } +/* + * call-seq: + * system_call_error.errno => fixnum + * + * Return this SystemCallError's error number. + */ + static VALUE syserr_errno(self) VALUE self; @@ -733,6 +809,15 @@ syserr_errno(self) return rb_attr_get(self, rb_intern("errno")); } +/* + * call-seq: + * system_call_error === other => true or false + * + * Return +true+ if the receiver is a generic +SystemCallError+, or + * if the error numbers _self_ and _other_ are the same. + */ + + static VALUE syserr_eqq(self, exc) VALUE self, exc; -- cgit