module Enumerable
def compact_blank
{ a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank
When called on a +Hash+, returns a new +Hash+ without the blank values.
# => [1]
Set.new([nil, "", 1, false]).compact_blank
# => [1, 2, true]
[1, "", nil, 2, " ", [], {}, false, true].compact_blank
Uses Object#blank? for determining if an item is blank.
Returns a new +Array+ without the blank items.
def compact_blank reject(&:blank?) end