1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-04-03 05:25:00 +00:00
parent 153f513f49
commit c94187bce0
7 changed files with 26 additions and 9 deletions

View file

@ -3,8 +3,14 @@ Wed Apr 02 15:11:23 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* README.EXT, README.EXT.ja (3.3): clarified -1 as free for
Data_Wrap_Struct(). [ruby-dev:19881]
Mon Mar 31 11:11:36 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_f_missing): use "inspect" for T_OBJECT as well.
Mon Mar 31 10:50:48 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_f_missing):
* hash.c (env_reject_bang): untaint key string.
* hash.c (env_delete_m): execute block only if deleting key does

View file

@ -1915,6 +1915,8 @@ Init_Array()
rb_define_alloc_func(rb_cArray, ary_alloc);
rb_define_singleton_method(rb_cArray, "[]", rb_ary_s_create, -1);
rb_define_method(rb_cArray, "initialize", rb_ary_initialize, -1);
rb_define_method(rb_cArray, "copy_object", rb_ary_replace, 1);
rb_define_method(rb_cArray, "to_s", rb_ary_to_s, 0);
rb_define_method(rb_cArray, "inspect", rb_ary_inspect, 0);
rb_define_method(rb_cArray, "to_a", rb_ary_to_a, 0);
@ -1948,7 +1950,6 @@ Init_Array()
rb_define_method(rb_cArray, "rindex", rb_ary_rindex, 1);
rb_define_method(rb_cArray, "indexes", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "indices", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "copy_object", rb_ary_replace, 1);
rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0);
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse_bang, 0);

6
eval.c
View file

@ -4509,11 +4509,11 @@ rb_f_missing(argc, argv, obj)
case T_FALSE:
desc = "false";
break;
case T_OBJECT:
d = rb_any_to_s(obj);
break;
default:
if (rb_respond_to(obj, rb_intern("inspect")))
d = rb_inspect(obj);
else
d = rb_any_to_s(obj);
break;
}
if (d) {

View file

@ -1270,7 +1270,7 @@ class TkVariable
def ==(other)
case other
when TkVariable
self.equal(self)
self.equal(other)
when String
self.to_s == other
when Integer

1
hash.c
View file

@ -1715,7 +1715,6 @@ Init_Hash()
rb_define_alloc_func(rb_cHash, hash_alloc);
rb_define_singleton_method(rb_cHash, "[]", rb_hash_s_create, -1);
rb_define_method(rb_cHash,"initialize", rb_hash_initialize, -1);
rb_define_method(rb_cHash,"copy_object", rb_hash_replace, 1);
rb_define_method(rb_cHash,"rehash", rb_hash_rehash, 0);

13
io.c
View file

@ -2886,6 +2886,17 @@ rb_io_s_new(argc, argv, klass)
return rb_class_new_instance(argc, argv, klass);
}
static VALUE
rb_io_s_for_fd(argc, argv, klass)
int argc;
VALUE *argv;
VALUE klass;
{
VALUE io = rb_obj_alloc(klass);
rb_io_initialize(argc, argv, io);
return io;
}
static int binmode = 0;
static VALUE
@ -3944,7 +3955,7 @@ Init_IO()
rb_define_singleton_method(rb_cIO, "new", rb_io_s_new, -1);
rb_define_singleton_method(rb_cIO, "open", rb_io_s_open, -1);
rb_define_singleton_method(rb_cIO, "sysopen", rb_io_s_sysopen, -1);
rb_define_singleton_method(rb_cIO, "for_fd", rb_class_new_instance, -1);
rb_define_singleton_method(rb_cIO, "for_fd", rb_io_s_for_fd, -1);
rb_define_singleton_method(rb_cIO, "popen", rb_io_s_popen, -1);
rb_define_singleton_method(rb_cIO, "foreach", rb_io_s_foreach, -1);
rb_define_singleton_method(rb_cIO, "readlines", rb_io_s_readlines, -1);

View file

@ -1721,8 +1721,8 @@ Init_Numeric()
rb_cNumeric = rb_define_class("Numeric", rb_cObject);
rb_include_module(rb_cNumeric, rb_mComparable);
rb_define_method(rb_cNumeric, "coerce", num_coerce, 1);
rb_define_method(rb_cNumeric, "copy_object", num_copy_object, 1);
rb_define_method(rb_cNumeric, "coerce", num_coerce, 1);
rb_define_method(rb_cNumeric, "+@", num_uplus, 0);
rb_define_method(rb_cNumeric, "-@", num_uminus, 0);