Detecting Deleted Entities

In one of my tools I’ve created a list of entities (groups), after an action by the user there exist the possibility of one or more of these entities being deleted and within the list this appears in its/their stead:

<Deleted Entity:0x17971b68>

or the list:

[#<Deleted Entity:0x17971b68>, #<Deleted Entity:0x17971bb8>, #<Deleted Entity:0x17971b90>]

Is there a simple way to detect this deleted state of the entity as I am looping through this list?

Disregard, I found the method: deleted?

Funny I’ve never actually used this one before.

There’s also a valid? method that is the inverse of deleted?. In some situations the code can be more readable if you ask whether an object is valid, rather than asking if it is not deleted (less negation is easier to parse).


Actually I think I may actually use the valid? method instead, I agree it is a bit more readable in this instance.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.