Sha256: 311be89a6757abe2461261a12a31a2667f9285fa40aeac3f6f7413f34fa1f5a4

Contents?: true

Size: 262 Bytes

Versions: 2

Compression:

Stored size: 262 Bytes

Contents

class Hash
  def needs(*keys)
    keys.each { |key| self[key] ||= '' }
  end

  alias :need :needs

  def keeps(*checks)
    delete_if do |key, value|
      checks.none? { |check| check === key }
    end
  end

  alias :keep :keeps
  alias :whitelist :keeps
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
junk_drawer-0.0.7 lib/core_extensions/hash.rb
junk_drawer-0.0.6 lib/core_extensions/hash.rb