Sha256: 23988e16bb48b0a63aee9217b09c229045291cb396cde64160f0fb7310f0480c

Contents?: true

Size: 475 Bytes

Versions: 2

Compression:

Stored size: 475 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:
  #
  #   @person.update_attributes(params[:person].except(:admin))
  def except(*keys)
    dup.except!(*keys)
  end

  # Replaces the hash without the given keys.
  def except!(*keys)
    keys.map! { |key| convert_key(key) } if respond_to?(:convert_key)
    keys.each { |key| delete(key) }
    self
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
activesupport-3.0.pre lib/active_support/core_ext/hash/except.rb
recliner-0.0.1 vendor/activesupport/lib/active_support/core_ext/hash/except.rb