ruby-changes:9522
From: yugui <ko1@a...>
Date: Fri, 26 Dec 2008 14:54:44 +0900 (JST)
Subject: [ruby-changes:9522] Ruby:r21062 (ruby_1_9_1): merges r20918 from trunk into ruby_1_9_1.
yugui 2008-12-26 14:54:18 +0900 (Fri, 26 Dec 2008) New Revision: 21062 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21062 Log: merges r20918 from trunk into ruby_1_9_1. * numeric.c (int_ord): Integer#ord implemented. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/numeric.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 21061) +++ ruby_1_9_1/ChangeLog (revision 21062) @@ -1,3 +1,7 @@ +Mon Dec 22 21:31:11 2008 Tanaka Akira <akr@f...> + + * numeric.c (int_ord): Integer#ord implemented. + Tue Dec 16 22:15:17 2008 Yukihiro Matsumoto <matz@r...> * lib/minitest/unit.rb (MiniTest::Assertions#assert_instance_of): Index: ruby_1_9_1/numeric.c =================================================================== --- ruby_1_9_1/numeric.c (revision 21061) +++ ruby_1_9_1/numeric.c (revision 21062) @@ -1925,7 +1925,27 @@ return str; } +/* + * call-seq: + * int.ord => int + * + * Returns the int itself. + * + * ?a.ord #=> 97 + * + * This method is intended for compatibility to + * character constant in Ruby 1.9. + * For example, ?a.ord returns 97 both in 1.8 and 1.9. + */ + static VALUE +int_ord(num) + VALUE num; +{ + return num; +} + +static VALUE int_numerator(VALUE num) { return num; @@ -3123,6 +3143,7 @@ rb_define_method(rb_cInteger, "next", int_succ, 0); rb_define_method(rb_cInteger, "pred", int_pred, 0); rb_define_method(rb_cInteger, "chr", int_chr, -1); + rb_define_method(rb_cInteger, "ord", int_ord, 0); rb_define_method(rb_cInteger, "to_i", int_to_i, 0); rb_define_method(rb_cInteger, "to_int", int_to_i, 0); rb_define_method(rb_cInteger, "floor", int_to_i, 0); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/