Ruby helper of the day: Array.compact

I just found this handy helper:

list.reject(&:nil?) == list.compact

It removes any nil elements from a given array see: docs

Leave a comment