From 33a031bcbb66d412691c5dcbb5060841d18f31b3 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 22 Nov 2002 09:14:24 +0000 Subject: * file.c (rb_find_file_ext): should not terminate searching with empty path, just ignore. * dir.c: remove inclusion. * compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using rb_cmpint(). * error.c (init_syserr): remove sys_nerr dependency. * numeric.c (num_cmp): added to satisfy Comparable assumption. * eval.c (rb_add_method): "initialize" should be public if it is a singleton method. * regex.c (re_match): avoid dereferencing if size == 0. (ruby-bugs-ja:PR#360) * time.c (time_cmp): should return nil if an operand is not a number nor time. (ruby-bugs-ja:PR#359) * file.c (rb_stat_cmp): should return nil if an operand is not File::Stat. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- numeric.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'numeric.c') diff --git a/numeric.c b/numeric.c index 553573b51..9bf953999 100644 --- a/numeric.c +++ b/numeric.c @@ -437,6 +437,14 @@ num_eql(x, y) return rb_equal(x, y); } +static VALUE +num_cmp(x, y) + VALUE x, y; +{ + if (x == y) return INT2FIX(0); + return Qnil; +} + static VALUE num_equal(x, y) VALUE x, y; @@ -1647,6 +1655,7 @@ Init_Numeric() rb_define_method(rb_cNumeric, "+@", num_uplus, 0); rb_define_method(rb_cNumeric, "-@", num_uminus, 0); rb_define_method(rb_cNumeric, "===", num_equal, 1); + rb_define_method(rb_cNumeric, "<=>", num_cmp, 1); rb_define_method(rb_cNumeric, "eql?", num_eql, 1); rb_define_method(rb_cNumeric, "/", num_div, 1); rb_define_method(rb_cNumeric, "divmod", num_divmod, 1); -- cgit