From: Robert Klemme Date: 2013-03-14T21:13:25+09:00 Subject: Re: RubyExcel class. Useful? On Thu, Mar 14, 2013 at 11:04 AM, Joel Pearson wrote: > Uh oh, I think I've backed myself into a corner... :-) > I assume that I'll need some sort of "dup" method in order to easily > differentiate between modifying an object in place and returning a copy. > However, in my attempts to interlink all the elements, I think I've > created a situation where I'll end up in a loop. > > RubyExcel holds "child" Sheets > Sheet links to "parent" RubyExcel > I know they aren't really parent and child, but I wasn't sure of the > best way to link them together. > > In order to dup RubyExcel I need to dup each sheet. > In order to dup a Sheet I need to dup RubyExcel. > > I've ended up with a circular reference and I'm not sure of the best way > to proceed from here. It may be an indication that you got your design wrong. Why did you think you need the circular references in the first place? > Also, is it sensible to have the namespaces stacked the way I've done > it? Like RubyExcel::Sheet::Element. I'd probably only have one level of namespaces for this, e.g. module RubyExcel and put all classes in there. You won't have too many classes to distribute across a multitude of namespaces. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/