summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorRadosław Bułat <radek.bulat@gmail.com>2020-12-18 19:14:23 +0100
committerYusuke Endoh <mame@ruby-lang.org>2020-12-19 12:23:58 +0900
commit51bcd50915941d21df806e8dcde769ae63b6eaaf (patch)
tree325554687a1a94ebcbb4dbcf34a03191c70deb8c /vm_method.c
parent34f6b22df073fe86e30aca99be5aa0b0eb8653df (diff)
Feature 17314: alias_method returns symbol
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/vm_method.c b/vm_method.c
index 9ee96886d8..1546722b14 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1941,13 +1941,13 @@ rb_alias(VALUE klass, ID alias_name, ID original_name)
/*
* call-seq:
- * alias_method(new_name, old_name) -> self
+ * alias_method(new_name, old_name) -> symbol
*
* Makes <i>new_name</i> a new copy of the method <i>old_name</i>. This can
* be used to retain access to methods that are overridden.
*
* module Mod
- * alias_method :orig_exit, :exit
+ * alias_method :orig_exit, :exit #=> :orig_exit
* def exit(code=0)
* puts "Exiting with code #{code}"
* orig_exit(code)
@@ -1968,8 +1968,9 @@ rb_mod_alias_method(VALUE mod, VALUE newname, VALUE oldname)
if (!oldid) {
rb_print_undef_str(mod, oldname);
}
- rb_alias(mod, rb_to_id(newname), oldid);
- return mod;
+ VALUE id = rb_to_id(newname);
+ rb_alias(mod, id, oldid);
+ return ID2SYM(id);
}
static void