diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-09 06:12:32 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-12-09 06:12:32 +0000 |
commit | a38ea9ec2908a7f4d58c47bf1cebecbf1741ab58 (patch) | |
tree | feae928f92078e11b905daa76584a88b699398fa /numeric.c | |
parent | b2b3cec36b893fe2ad958f627ca8ea9a1cd1c00a (diff) |
* numeric.c (num_cmp): define Numeric#<=>, remove Numeric#==.
* eval.c (backtrace): should ignore line 0 frame.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@3119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -423,6 +423,14 @@ num_eql(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; { @@ -1559,8 +1567,8 @@ 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_equal, 1); + rb_define_method(rb_cNumeric, "<=>", num_cmp, 1); rb_define_method(rb_cNumeric, "eql?", num_eql, 1); rb_define_method(rb_cNumeric, "divmod", num_divmod, 1); rb_define_method(rb_cNumeric, "modulo", num_modulo, 1); |