diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-07-07 17:58:25 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-07-23 09:46:09 -0700 |
commit | 9aba971e42c78bb9e446f28c0402bad55147a863 (patch) | |
tree | 4fcb7065a00fc0a7306d80df7f1332056920e855 /class.c | |
parent | 11662c70b073da21dcd5213b61434bce2ed6af8f (diff) |
Make Object#singleton_methods work correctly for singleton classes of objects
Fixes [Bug #10901]
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -1447,6 +1447,9 @@ rb_obj_singleton_methods(int argc, const VALUE *argv, VALUE obj) int recur = TRUE; if (rb_check_arity(argc, 0, 1)) recur = RTEST(argv[0]); + if (RB_TYPE_P(obj, T_CLASS) && FL_TEST(obj, FL_SINGLETON)) { + rb_singleton_class(obj); + } klass = CLASS_OF(obj); origin = RCLASS_ORIGIN(klass); me_arg.list = st_init_numtable(); |