The collection’s #[] method will return nil if the definition name has not yet been used.
The absolute necessity for uniqueness of member names applies for all of the SketchUp API’s collection classes that allow access by name via their #[] method.
So generally, for any collection member object, if you attempt to set the member’s name property to a name that is already in use, then the API will “difference” the name by adding " #n" where n is an integer that forces the name to be unique.*
* This also applies to manual user actions through the GUI when bringing resources into the model such as definitions, materials, etc.
If you wanted to reuse the name "House", you would first need to delete the old definition using that name.
dlist = active_mod.definitions
if old_house = dlist['House']
dlist.remove(old_house) if old_house.instances.empty
end
If you do not care if old_house had instances, then calling dlist.remove(old_house) will delete those instances from the model or the entities of any other definition (whether used or not.)
ADD: the other option is to rename the old_house definition.