Sha256: 0decba19f66e573c2718cf55465872915493671f2e1b792009ca67debf0985c8

Contents?: true

Size: 395 Bytes

Versions: 49

Compression:

Stored size: 395 Bytes

Contents

class Hash
  # Returns 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(params[:person].except(:admin))
  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

49 entries across 49 versions & 5 rubygems

Version Path
activesupport-4.1.16 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.16.rc1 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.15 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.15.rc1 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.14.2 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.14.1 lib/active_support/core_ext/hash/except.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/activesupport-4.1.13/lib/active_support/core_ext/hash/except.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/activesupport-4.1.13/lib/active_support/core_ext/hash/except.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/activesupport-4.1.13/lib/active_support/core_ext/hash/except.rb
activesupport-4.1.14 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.14.rc2 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.14.rc1 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.13 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.13.rc1 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.12 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.12.rc1 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.11 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.10 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.10.rc4 lib/active_support/core_ext/hash/except.rb
activesupport-4.1.10.rc3 lib/active_support/core_ext/hash/except.rb