Sha256: d471fd5a776859907234620e3dccfffee6ebad77f4cd2a019ccfa1b0240e6036

Contents?: true

Size: 337 Bytes

Versions: 2

Compression:

Stored size: 337 Bytes

Contents

class Hash
  # Return a hash that includes everything but the given keys. This is useful for
  # limiting a set of parameters to everything but a few known toggles:
  def except(*keys)
    dup.except!(*keys)
  end

  # Replaces the hash without the given keys.
  def except!(*keys)
    keys.each { |key| delete(key) }
    self
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
clieop-1.0.1 lib/core_ext/hash.rb
clieop-1.0.0 lib/core_ext/hash.rb