--Multipart_Mon_Aug_26_22:32:39_2002-1 Content-Type: text/plain; charset=US-ASCII At Tue, 27 Aug 2002 12:01:25 +0900, Tom Sawyer wrote: > > this could work (i actually haven't run it) but the problem is that the > type of the object returned is not Text, but TextSingle or TextMultiple. > i need it to be Text. eg. > > atext ext.new(1) > p atext.class # --> TextSingle > > for it it needs to be: > > p atext.class # --> Text Hmmm ... this seems like a perfect spot for forwardable.rb to me: require "forwardable" class Text extend Forwardable def initialize(component) if(component < ) @proxy extSingle.new else @proxy extMultiple.new end end def_delegator(:@proxy, :meth) class TextSingle def meth puts "I'm from TextSingle!" end end class TextMultiple def meth puts "I'm from TextMultiple!" end end end --Multipart_Mon_Aug_26_22:32:39_2002-1 Content-Type: text/plain; charset=US-ASCII -- /^Dan Debertin$/ airboss / nodewarrior.org | Did I sleep a little too late, www.nodewarrior.org | or am I awake? --Byrne --Multipart_Mon_Aug_26_22:32:39_2002-1 Content-Type: text/plain; charset=US-ASCII -- /^Dan Debertin$/ airboss / nodewarrior.org | Did I sleep a little too late, www.nodewarrior.org | or am I awake? --Byrne --Multipart_Mon_Aug_26_22:32:39_2002-1--