Sha256: c18e586ae4396c2f579fcb8f4c7f79f4614e049ca6cd3a434ad262d38537aa48
Contents?: true
Size: 275 Bytes
Versions: 2
Compression:
Stored size: 275 Bytes
Contents
# encoding: utf-8 class Hash # Recursively deletes all key/value pairs where the value is empty string/array/hash or nil. def deep_delete_blank delete_if do |_, v| (v.blank? && v != false) || v.instance_of?(Hash) && v.deep_delete_blank.empty? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inactive_support-1.3.0 | lib/inactive_support/hash/deep_delete_blank.rb |
inactive_support-1.2.0 | lib/inactive_support/hash/deep_delete_blank.rb |