On 04.11.2009 02:05, Caleb Clausen wrote:
> On 11/3/09, Robert Klemme <shortcutter / googlemail.com> wrote:
>> This will be difficult to do because then StringIO would somehow have
>> to change its type.  Of course you could achieve that with some kind
> 
> IO subclasses can already change their type (and even class!) when
> #reopen is called:
> 
> irb(main):001:0> f=File.open "endless.rb"
> => #<File:endless.rb>
> irb(main):002:0> f.reopen STDIN
> => #<IO:0xb7d267cc>
> irb(main):003:0> f
> => #<IO:0xb7d267cc>
> 
> Clearly StringIO is not a subclass of IO, but maybe this is why it should be?

Amazing, I wasn't aware of that.  Not sure though whether a change from 
IO / File to StringIO or reverse would be possible since IO and File are 
much more similar...

Thanks for the update!

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/