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

* file.c (rb_get_path): use the original object if to_path method is

not defined.  [ruby-dev:32473]

* io.c (rb_f_open): call to_open on non-string objects, instead of
  to_str.  [ruby-dev:32473]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-12-09 03:18:21 +00:00
parent 45fa4a4b63
commit 54f236542d
3 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,11 @@
Sun Dec 9 12:18:19 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_get_path): use the original object if to_path method is
not defined. [ruby-dev:32473]
* io.c (rb_f_open): call to_open on non-string objects, instead of
to_str. [ruby-dev:32473]
Sun Dec 9 12:12:23 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (tr_find): returns true if no characters to be removed is

3
file.c
View file

@ -111,6 +111,9 @@ rb_get_path(VALUE obj)
if (rb_respond_to(obj, to_path)) {
tmp = rb_funcall(obj, to_path, 0, 0);
}
else {
tmp = obj;
}
exit:
StringValueCStr(tmp);
if (obj != tmp) {

3
io.c
View file

@ -3799,7 +3799,8 @@ rb_f_open(int argc, VALUE *argv)
redirect = Qtrue;
}
else {
VALUE tmp = rb_check_string_type(argv[0]);
VALUE tmp = argv[0];
FilePathValue(tmp);
if (NIL_P(tmp)) {
redirect = Qtrue;
}