Sha256: b9c5cd7c1f2317bf8be51282361f2cd358a3c6accf748008f1197a2586cbb78c

Contents?: true

Size: 141 Bytes

Versions: 4

Compression:

Stored size: 141 Bytes

Contents

class Hash
  def compact
    inject({}) do |result, (key, value)|
      result[key] = value unless value.nil?
      result
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
perkins-0.0.5 lib/core_ext/hash/compact.rb
perkins-0.0.3 lib/core_ext/hash/compact.rb
perkins-0.0.2 lib/core_ext/hash/compact.rb
perkins-0.0.1 lib/core_ext/hash/compact.rb