mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* object.c (rb_obj_cmp): defines Object#<=>. [ruby-core:24063]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
66ed25f633
commit
51f033f853
3 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Oct 24 13:38:45 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* object.c (rb_obj_cmp): defines Object#<=>. [ruby-core:24063]
|
||||||
|
|
||||||
Sat Oct 24 00:36:47 2009 Tanaka Akira <akr@fsij.org>
|
Sat Oct 24 00:36:47 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* io.c (io_cntl): update max file descriptor by the result of
|
* io.c (io_cntl): update max file descriptor by the result of
|
||||||
|
|
|
@ -115,7 +115,7 @@
|
||||||
# implementation, see SimpleDelegator.
|
# implementation, see SimpleDelegator.
|
||||||
#
|
#
|
||||||
class Delegator
|
class Delegator
|
||||||
[:to_s,:inspect,:=~,:!~,:===].each do |m|
|
[:to_s,:inspect,:=~,:!~,:===,:<=>].each do |m|
|
||||||
undef_method m
|
undef_method m
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
10
object.c
10
object.c
|
@ -1119,6 +1119,15 @@ rb_obj_not_match(VALUE obj1, VALUE obj2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* :nodoc: */
|
||||||
|
static VALUE
|
||||||
|
rb_obj_cmp(VALUE obj1, VALUE obj2)
|
||||||
|
{
|
||||||
|
if (obj1 == obj2 || rb_obj_equal(obj1, obj2))
|
||||||
|
return INT2FIX(0);
|
||||||
|
return Qnil;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
*
|
*
|
||||||
* Document-class: Module
|
* Document-class: Module
|
||||||
|
@ -2555,6 +2564,7 @@ Init_Object(void)
|
||||||
rb_define_method(rb_mKernel, "!~", rb_obj_not_match, 1);
|
rb_define_method(rb_mKernel, "!~", rb_obj_not_match, 1);
|
||||||
rb_define_method(rb_mKernel, "eql?", rb_obj_equal, 1);
|
rb_define_method(rb_mKernel, "eql?", rb_obj_equal, 1);
|
||||||
rb_define_method(rb_mKernel, "hash", rb_obj_hash, 0);
|
rb_define_method(rb_mKernel, "hash", rb_obj_hash, 0);
|
||||||
|
rb_define_method(rb_mKernel, "<=>", rb_obj_cmp, 1);
|
||||||
|
|
||||||
rb_define_method(rb_mKernel, "class", rb_obj_class, 0);
|
rb_define_method(rb_mKernel, "class", rb_obj_class, 0);
|
||||||
rb_define_method(rb_mKernel, "clone", rb_obj_clone, 0);
|
rb_define_method(rb_mKernel, "clone", rb_obj_clone, 0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue