Sha256: f56c010181bfe53657a3d3f0b4db18f68ecac1b1e331b53b1712e21d174a0fd1

Contents?: true

Size: 182 Bytes

Versions: 1

Compression:

Stored size: 182 Bytes

Contents

class Hash
  def compact
    dup.compact!
  end

  def compact!
    keys.each do |key|
      delete(key) if self[key].nil?
    end
    self
  end
end unless {}.respond_to?(:compact)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
travis-core-0.0.1 lib/core_ext/hash/compact.rb