summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-06-18 09:00:34 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-06-18 09:00:34 +0900
commit957825639c1422777c09578d4a03adf571eac55d (patch)
tree9b50eb12f4356b544069ee1a56297b0fc2dae557
parente14cba354ca031b48de0720fe0d96c04d9bb3439 (diff)
[DOC] Added Exception.exception to Exception.new [ci skip]
-rw-r--r--error.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/error.c b/error.c
index af4dc23dde..d812f490ff 100644
--- a/error.c
+++ b/error.c
@@ -1003,7 +1003,8 @@ exc_init(VALUE exc, VALUE mesg)
/*
* call-seq:
- * Exception.new(msg = nil) -> exception
+ * Exception.new(msg = nil) -> exception
+ * Exception.exception(msg = nil) -> exception
*
* Construct a new Exception object, optionally passing in
* a message.
@@ -2572,7 +2573,7 @@ void
Init_Exception(void)
{
rb_eException = rb_define_class("Exception", rb_cObject);
- rb_define_singleton_method(rb_eException, "exception", rb_class_new_instance, -1);
+ rb_define_alias(rb_singleton_class(rb_eException), "exception", "new");
rb_define_singleton_method(rb_eException, "to_tty?", exc_s_to_tty_p, 0);
rb_define_method(rb_eException, "exception", exc_exception, -1);
rb_define_method(rb_eException, "initialize", exc_initialize, -1);