diff options
author | Ufuk Kayserilioglu <ufuk@paralaus.com> | 2022-09-27 01:19:22 +0300 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2022-10-20 17:30:17 +0200 |
commit | 0378e2f4a8319440dd65c82b16f189161472d237 (patch) | |
tree | 6c2c6dd91c624fd4ae6ad4be5dd3a6d04528df37 /include/ruby/internal/intern/class.h | |
parent | 192bc725290ca4b271bff2bae6123d84c25f7173 (diff) | |
download | ruby-0378e2f4a8319440dd65c82b16f189161472d237.tar.gz |
Add Class#attached_object
Implements [Feature #12084]
Returns the object for which the receiver is the singleton class, or
raises TypeError if the receiver is not a singleton class.
Diffstat (limited to 'include/ruby/internal/intern/class.h')
-rw-r--r-- | include/ruby/internal/intern/class.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/ruby/internal/intern/class.h b/include/ruby/internal/intern/class.h index 2181ab93c7..0fb2d001bc 100644 --- a/include/ruby/internal/intern/class.h +++ b/include/ruby/internal/intern/class.h @@ -200,6 +200,18 @@ VALUE rb_class_descendants(VALUE klass); */ VALUE rb_class_subclasses(VALUE klass); + +/** + * Returns the attached object for a singleton class. + * If the given class is not a singleton class, raises a TypeError. + * + * @param[in] klass A class. + * @return The object which has the singleton class `klass`. + * + * @internal + */ +VALUE rb_class_attached_object(VALUE klass); + /** * Generates an array of symbols, which are the list of method names defined in * the passed class. |