ruby-changes:2412
From: ko1@a...
Date: 13 Nov 2007 14:00:27 +0900
Subject: [ruby-changes:2412] akr - Ruby:r13903 (ruby_1_8): * numeric.c (numeric.c): Integer#ord implemented.
akr 2007-11-13 14:00:03 +0900 (Tue, 13 Nov 2007)
New Revision: 13903
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/numeric.c
Log:
* numeric.c (numeric.c): Integer#ord implemented. [ruby-dev:32206]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=13903&r2=13902
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/numeric.c?r1=13903&r2=13902
Index: ruby_1_8/numeric.c
===================================================================
--- ruby_1_8/numeric.c (revision 13902)
+++ ruby_1_8/numeric.c (revision 13903)
@@ -1807,6 +1807,26 @@
return rb_str_new(&c, 1);
}
+/*
+ * 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;
+}
+
/********************************************************************
*
* Document-class: Fixnum
@@ -2924,6 +2944,7 @@
rb_define_method(rb_cInteger, "succ", int_succ, 0);
rb_define_method(rb_cInteger, "next", int_succ, 0);
rb_define_method(rb_cInteger, "chr", int_chr, 0);
+ 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);
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 13902)
+++ ruby_1_8/ChangeLog (revision 13903)
@@ -1,3 +1,7 @@
+Tue Nov 13 13:58:51 2007 Tanaka Akira <akr@f...>
+
+ * numeric.c (numeric.c): Integer#ord implemented. [ruby-dev:32206]
+
Tue Nov 13 02:57:04 2007 URABE Shyouhei <shyouhei@i...>
* numeric.c (flo_divmod): round to the nearest integer.
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml