[macruby-changes] [5250] MacRuby/trunk/io.c
source_changes at macosforge.org
source_changes at macosforge.org
Thu Mar 3 23:40:57 PST 2011
Revision: 5250
http://trac.macosforge.org/projects/ruby/changeset/5250
Author: watson1978 at gmail.com
Date: 2011-03-03 23:40:56 -0800 (Thu, 03 Mar 2011)
Log Message:
-----------
IO#try_convert will raise TypeError if the object does not return an IO from #to_io.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
obj = Object.new
def obj.to_io
'foo'
end
assert_raise(TypeError){ IO.try_convert(obj) }
puts :ok
}}}
Modified Paths:
--------------
MacRuby/trunk/io.c
Modified: MacRuby/trunk/io.c
===================================================================
--- MacRuby/trunk/io.c 2011-03-04 07:40:52 UTC (rev 5249)
+++ MacRuby/trunk/io.c 2011-03-04 07:40:56 UTC (rev 5250)
@@ -3597,9 +3597,7 @@
static VALUE
rb_io_s_try_convert(VALUE dummy, SEL sel, VALUE obj)
{
- return rb_respond_to(obj, rb_intern("to_io"))
- ? rb_funcall3(obj, rb_intern("to_io"), 0, 0)
- : Qnil;
+ return rb_io_check_io(obj);
}
/*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110303/0d16f77a/attachment.html>
More information about the macruby-changes
mailing list