From: Hal Fulton Date: 2004-04-24T05:09:42+09:00 Subject: Re: StringIO why the lucky stiff wrote: > Hal Fulton wrote: > >> I've been playing with StringIO, and I've found that it doesn't inherit >> from IO. >> >> I had thought this would be natural, as it would in theory permit us to >> use a StringIO wherever an IO is used. > > > I don't know exactly what you're getting at, but, in watching checkins > on Ruby CVS, anything that read: > > if obj.is_a? IO > > was swapped to: > > if obj.respond_to? :read > > over the last year. I'm not saying StringIO shouldn't inherit from IO. > Just that it's become less important what descends from IO and more > important what implements obj#read. Oh, certainly, I agree. But I tried to use #select with a StringIO and it complained. (If this is unreasonable, tell me, but it's not obvious to me.) Hal