Sha256: febeadc75327c7aa0ece5746b318e477f048eb85938bc399ae5bb9e4ebf89a12
Contents?: true
Size: 644 Bytes
Versions: 7
Compression:
Stored size: 644 Bytes
Contents
require 'gorillib/object/blank' class Hash # # remove all key-value pairs where the value is nil # def compact reject{|key,val| val.nil? } end unless method_defined?(:compact) # # Replace the hash with its compacted self # def compact! replace(compact) end unless method_defined?(:compact!) # # remove all key-value pairs where the value is blank # def compact_blank reject{|key,val| val.blank? } end unless method_defined?(:compact_blank) # # Replace the hash with its compact_blank'ed self # def compact_blank! replace(compact_blank) end unless method_defined?(:compact_blank!) end
Version data entries
7 entries across 7 versions & 1 rubygems