ruby: fix container invalidation

The container enumeration was given self.class *from within the class*,
which means that it was always iterating over the Class object.

It means that invalidation was never enabled it in the first place
ruby: fix invalidation of types that have vectors-in-vectors
ruby: fix CompoundType#get now raising TypeError if called on an invalidated object
ruby: do not deregister memzone entries from the type and layout maps if the zone is still referenced

When memory_unref got refactored, the delete/unref stages have been
properly guarded in a if(!entry->refcount) block. However, the
memory_types and memory_layout maps were not. This led to memory leaks as
the corresponding zones would not get finally deleted (type info
not available).