Pit, thanks very my for your comments and insights!

Pit Capitain wrote:
> 
> I think you can use named classes just as well as anonymous classes:
> 
>    class HostService < Section
>      ...
>      def sub_sections( kind )
>        {'actions' => [nil, ActionList, @actions ],
>         'files'   => [nil, CommaList, @files],
>        ...
>      end
>    end

Yup, that works.  I tried this initially but had problems (clearly 
something else was wrong).  That's a useful simplication.

> 
> (Note that I renamed the method. See
> http://wiki.rubygarden.org/Ruby/page/show/RubyStyleGuide)

Ah, right... time for some global sustitutions :)

[good stuff snipped for brevity ]

>> wrote a generic text parser for this project and because Ruby does not 
>> support multiple inheiritance I ended up passing an instance of the 
>> parser as a parameter to all the methods -- I figured that since the 
>> parser needed to maintain state that I could not make it a mixin...
> 
> Modules in Ruby can maintain state. 
> 

Yep, I worked that out eventually and the parser now works much better 
as a mixin.  I've renamed initialize to setup and call it explictly...

Seems to work fine.  :)

I have redesigned things so I am not having to resort to reference to 
get values out of sub classes.  So everything is looking good -- thanks 
to the good folk on this list/forum!

Russell

-- 
Posted via http://www.ruby-forum.com/.