summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2022-08-24 14:15:41 -0700
committerJeremy Evans <code@jeremyevans.net>2022-08-24 14:15:41 -0700
commitf5f81bb777bb1dbf8da3f976136733e65b026fef (patch)
tree67fc387e978c4cdd47cc285b0e432b35f72c08cc /class.c
parent28a3434634a0116a6f2b9e2df0bcbbfb0cfbd28b (diff)
Update Module#instance_methods documentation for visibility changes/aliases
Requested by matz in comment on #18435.
Diffstat (limited to 'class.c')
-rw-r--r--class.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/class.c b/class.c
index 54d9e6e177..5e57068f03 100644
--- a/class.c
+++ b/class.c
@@ -1755,6 +1755,15 @@ class_instance_method_list(int argc, const VALUE *argv, VALUE mod, int obj, int
* B.instance_methods(true).include?(:method1) #=> true
* C.instance_methods(false) #=> [:method3]
* C.instance_methods.include?(:method2) #=> true
+ *
+ * Note that method visibility changes in the current class, as well as aliases,
+ * are considered as methods of the current class by this method:
+ *
+ * class C < B
+ * alias method4 method2
+ * protected :method2
+ * end
+ * C.instance_methods(false).sort #=> [:method2, :method3, :method4]
*/
VALUE