Sebastian Reid wrote:

> @registry unfortunately is not within my command, though yes I did
> consider using objects for its contents.  I'd rather use simpler
> (though nested) structures first if I can.
> 
> The problem with being explicit when initialising the nested
> structures is that they're going to be pretty dynamic throughout, not
> to mention the structure itself being changed as I go along.
> 
> That said, how would I go about initialising a hash in a hash value
> that doesn't exist yet and won't until runtime?

Let's say we have an instance variable named "hash" that we are not sure has
been initialized at runtime, and we want to create a new hash where there
is none, but only then. Add this line:

hash ||= {}

Means "if 'hash' is a hash, do nothing, otherwise create a hash".

-- 
Paul Lutus
http://www.arachnoid.com