ruby-changes:73055
From: Jeremy <ko1@a...>
Date: Thu, 25 Aug 2022 06:18:09 +0900 (JST)
Subject: [ruby-changes:73055] f5f81bb777 (master): Update Module#instance_methods documentation for visibility changes/aliases
https://git.ruby-lang.org/ruby.git/commit/?id=f5f81bb777 From f5f81bb777bb1dbf8da3f976136733e65b026fef Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Wed, 24 Aug 2022 14:15:41 -0700 Subject: Update Module#instance_methods documentation for visibility changes/aliases Requested by matz in comment on #18435. --- class.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 https://github.com/ruby/ruby/blob/trunk/class.c#L1755 * 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/