зеркало из https://github.com/github/ruby.git
Docs: Separate documentation for UnboundMethod#==
This commit is contained in:
Родитель
b3d57fdd64
Коммит
64cdf1936a
20
proc.c
20
proc.c
|
@ -1840,6 +1840,22 @@ method_eq(VALUE method, VALUE other)
|
|||
return Qtrue;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче