method

compact_blank!

Importance_1
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: Hash
compact_blank!() public

Removes all blank values from the Hash in place and returns self. Uses Object#blank? for determining if a value is blank.

h = { a: "", b: 1, c: nil, d: [], e: false, f: true }
h.compact_blank!
# => { b: 1, f: true }
Show source
Register or log in to add new notes.