Forum: Ruby-core [ruby-trunk - Bug #7873][Open] StringIO does not respond to to_io

Posted by ueno (Daiki Ueno) (Guest)
on 2013-02-17 03:08
(Received via mailing list)
Issue #7873 has been reported by ueno (Daiki Ueno).

----------------------------------------
Bug #7873: StringIO does not respond to to_io
https://bugs.ruby-lang.org/issues/7873

Author: ueno (Daiki Ueno)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]


In my project, I'm using "object.respond_to? :to_io" to check if the 
object is IO-ish[1].
(I heard that this is the preferred way to do that some time ago.)

However, StringIO does not seem to define to_io.  Is this intended?

[1] https://github.com/ueno/ruby-gpgme/pull/18
Posted by drbrain (Eric Hodel) (Guest)
on 2013-02-17 05:13
(Received via mailing list)
Issue #7873 has been updated by drbrain (Eric Hodel).

Category set to ext
Status changed from Open to Rejected

It is intended.  StringIO only pretends to be an IO, it is not backed by 
a socket or file like an IO is.
----------------------------------------
Bug #7873: StringIO does not respond to to_io
https://bugs.ruby-lang.org/issues/7873#change-36353

Author: ueno (Daiki Ueno)
Status: Rejected
Priority: Normal
Assignee:
Category: ext
Target version:
ruby -v: ruby 1.9.3p385 (2013-02-06 revision 39114) [x86_64-linux]


In my project, I'm using "object.respond_to? :to_io" to check if the 
object is IO-ish[1].
(I heard that this is the preferred way to do that some time ago.)

However, StringIO does not seem to define to_io.  Is this intended?

[1] https://github.com/ueno/ruby-gpgme/pull/18
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.