Sha256: 91bea68cdf8a36beb6ca91466f11cee6ab2684b579ff400bba6bba9016bcdd1c

Contents?: true

Size: 204 Bytes

Versions: 2

Compression:

Stored size: 204 Bytes

Contents

# encoding: utf-8
class Hash
  # Deletes all key/value pairs where the value is empty string/array/hash or nil.
  def delete_blank
    delete_if do |_, v|
      (v.blank? && v != false)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
inactive_support-1.3.0 lib/inactive_support/hash/delete_blank.rb
inactive_support-1.2.0 lib/inactive_support/hash/delete_blank.rb