class Hash

def compact_blank!

# => { b: 1, f: true }
h.compact_blank!
h = { a: "", b: 1, c: nil, d: [], e: false, f: true }

Uses Object#blank? for determining if a value is blank.
Removes all blank values from the +Hash+ in place and returns self.
def compact_blank!
  # use delete_if rather than reject! because it always returns self even if nothing changed
  delete_if { |_k, v| v.blank? }
end