diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-06-18 11:40:32 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-06-18 11:40:32 +0900 |
| commit | fa1c1ab4875cb7a9adb1f22beb0a641ff940c8a9 (patch) | |
| tree | 2371d8e9147154954ff9980f91c4b15d989d9e49 | |
| parent | a8af43f61e3d8421e0fb2daa2f681baf3fdf5698 (diff) | |
| parent | 8a15ab0c0cd8cd71cf315b6a2e40780cbf213cf1 (diff) | |
| download | mruby-fa1c1ab4875cb7a9adb1f22beb0a641ff940c8a9.tar.gz mruby-fa1c1ab4875cb7a9adb1f22beb0a641ff940c8a9.zip | |
Merge pull request #3163 from mattn/fix-public_methods
Fix public methods
| -rw-r--r-- | src/kernel.c | 4 | ||||
| -rw-r--r-- | test/t/kernel.rb | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/kernel.c b/src/kernel.c index af6a49be1..54b5f23b6 100644 --- a/src/kernel.c +++ b/src/kernel.c @@ -722,9 +722,7 @@ mrb_obj_singleton_methods(mrb_state *mrb, mrb_bool recur, mrb_value obj) static mrb_value mrb_obj_methods(mrb_state *mrb, mrb_bool recur, mrb_value obj, mrb_method_flag_t flag) { - if (recur) - return mrb_class_instance_method_list(mrb, recur, mrb_class(mrb, obj), 0); - return mrb_obj_singleton_methods(mrb, recur, obj); + return mrb_class_instance_method_list(mrb, recur, mrb_class(mrb, obj), 0); } /* 15.3.1.3.31 */ /* diff --git a/test/t/kernel.rb b/test/t/kernel.rb index 6df2294d5..927166283 100644 --- a/test/t/kernel.rb +++ b/test/t/kernel.rb @@ -423,6 +423,11 @@ end assert('Kernel#public_methods', '15.3.1.3.38') do assert_equal Array, public_methods.class + class Foo + def foo + end + end + assert_equal [:foo], Foo.new.public_methods(false) end # Kernel#puts is defined in mruby-print mrbgem. '15.3.1.3.39' |
