diff options
author | zverok <zverok.offline@gmail.com> | 2022-12-21 21:51:08 +0200 |
---|---|---|
committer | Victor Shepelev <zverok.offline@gmail.com> | 2022-12-23 18:09:49 +0200 |
commit | 64cdf1936a3952fbd43083de55244dd1b701cce6 (patch) | |
tree | 5c721957b8464263def40afb359380fd0ad5231a /proc.c | |
parent | b3d57fdd64d2e88499bf718e64522dfce9358c48 (diff) | |
download | ruby-64cdf1936a3952fbd43083de55244dd1b701cce6.tar.gz |
Docs: Separate documentation for UnboundMethod#==
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1842,6 +1842,22 @@ method_eq(VALUE method, VALUE other) /* * call-seq: + * meth.eql?(other_meth) -> true or false + * meth == other_meth -> true or false + * + * Two unbound method objects are equal if they refer to the same + * method definition. + * + * Array.instance_method(:each_slice) == Enumerable.instance_method(:each_slice) + * #=> true + * + * Array.instance_method(:sum) == Enumerable.instance_method(:sum) + * #=> false, Array redefines the method for efficiency + */ +#define unbound_method_eq method_eq + +/* + * call-seq: * meth.hash -> integer * * Returns a hash value corresponding to the method object. @@ -4334,8 +4350,8 @@ Init_Proc(void) rb_cUnboundMethod = rb_define_class("UnboundMethod", rb_cObject); rb_undef_alloc_func(rb_cUnboundMethod); rb_undef_method(CLASS_OF(rb_cUnboundMethod), "new"); - rb_define_method(rb_cUnboundMethod, "==", method_eq, 1); - rb_define_method(rb_cUnboundMethod, "eql?", method_eq, 1); + rb_define_method(rb_cUnboundMethod, "==", unbound_method_eq, 1); + rb_define_method(rb_cUnboundMethod, "eql?", unbound_method_eq, 1); rb_define_method(rb_cUnboundMethod, "hash", method_hash, 0); rb_define_method(rb_cUnboundMethod, "clone", method_clone, 0); rb_define_method(rb_cUnboundMethod, "arity", method_arity_m, 0); |