IO#reopen should be able to handle argument of arbitrary type if it responds to 
"to_io" 
----------------------------------------------------------------------------------------

                 Key: JRUBY-1909
                 URL: http://jira.codehaus.org/browse/JRUBY-1909
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1b2
         Environment: Latest JRuby 1.1b1
            Reporter: Vladimir Sizikov


Consider the following example:

{noformat}
obj = Object.new

def obj.to_io
  File.open("/tmp/some-file", "w+")
end

p "Before reopen"
$stdout.reopen(obj)
p "After reopen"
{noformat}

MRI prints:
"Before reopen"

JRuby prints:
"Before reopen"
"After reopen"

MRI correctly forwards "After repopen" message to the object, specified in 
to_io. In our case - to a file.
JRuby doesn't understand argument of non-IO type, doesn't call the to_io 
method, and just
silently ignores the whole reopen thing in this case, not changing anything.

Fix is coming.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to