mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* numeric.c (int_ord): Integer#ord implemented.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b795b5c537
commit
a550f2992b
2 changed files with 25 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Mon Dec 22 21:31:11 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* numeric.c (int_ord): Integer#ord implemented.
|
||||
|
||||
Mon Dec 22 21:26:12 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c (rb_io_s_pipe): IO.pipe can take a block.
|
||||
|
|
21
numeric.c
21
numeric.c
|
@ -1926,6 +1926,26 @@ int_chr(int argc, VALUE *argv, VALUE num)
|
|||
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)
|
||||
{
|
||||
|
@ -3124,6 +3144,7 @@ Init_Numeric(void)
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue