"Robert Klemme" <bob.news / gmx.net> writes:

> module SomeDocumentation
>   class Named
>     attr :name
>
>     def initialize(name)
>       @name = name
>     end
>   end
>
>   class Host < Named
>     INSTANCES = Hash.new {|h,name| h[name] = self.new(name) }
>   end
>
>   class Role < Named
>     INSTANCES = Hash.new {|h,name| h[name] = self.new(name) }
>   end
> end
>
> SomeDocumentation::Host::INSTANCES["foo"]
> SomeDocumentation::Role::INSTANCES["foo"]

Brilliant, thank you.  I think I need to study it for a while, to see
exactly what it does in combination with my code, though. :)

In addition to this, I also got a message outside the newsgroup
telling me to use a @@instances hash in the classes, which seems to be
about the same solution.

-- 
Sandbeck Mathisen - http://fnord.no
  Trust the Computer, the Computer is your Friend