I often need to do a
reject! and return the rejected items instead of the modified collection. This saves having to do a
An example of how accomplish this:
This could be written as a method of the
Hash class and an alternative for
Hash, the code would look something like:
If I am missing something obvious in Ruby that accomplishes the same, please leave a comment.