From: Luciano Ramalho Date: 2007-02-14T04:40:10+09:00 Subject: Re: Ruby, OO newb, subclassing question On 2/13/07, Newbie wrote: > def initialize(filename) > open(filename,'w') #Don't know why this does not return a file object > end It does return a file, but you don't do anything with it... initialize is not used to create an instance, but only to initialize de attributes of an instance created by Ruby when you invoke HtmlReport.new. So you'd have to assign the opened file to an instance variable of your classe to avoid loosing the reference to it. But the problem is deeper than that. I would not want to subclass File. Subclassing is cool and very attractive when you first study OO, but it's not the right solution in many cases. Cheers, Luciano