aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-08-01 01:55:45 +0300
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-08-03 19:08:12 +0300
commitb8d280b2dcacbff9ad8239d5ba4d099f25de540a (patch)
tree49869a82374a6a4ffbad99dd83f993cf7bcdb444 /activesupport
parentd1cdf52db608ad53b676581f9482e100d4be35bd (diff)
downloadrails-b8d280b2dcacbff9ad8239d5ba4d099f25de540a.tar.gz
rails-b8d280b2dcacbff9ad8239d5ba4d099f25de540a.tar.bz2
rails-b8d280b2dcacbff9ad8239d5ba4d099f25de540a.zip
Fix the documentation of Hash#except method [ci skip]
fix minor problems
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/except.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/except.rb b/activesupport/lib/active_support/core_ext/hash/except.rb
index 6e397abf51..2f6d38c1f6 100644
--- a/activesupport/lib/active_support/core_ext/hash/except.rb
+++ b/activesupport/lib/active_support/core_ext/hash/except.rb
@@ -1,8 +1,9 @@
class Hash
- # Returns a hash that includes everything but the given keys.
- # hash = { a: true, b: false, c: nil}
- # hash.except(:c) # => { a: true, b: false}
- # hash # => { a: true, b: false, c: nil}
+ # Returns a hash that includes everything except given keys.
+ # hash = { a: true, b: false, c: nil }
+ # hash.except(:c) # => { a: true, b: false }
+ # hash.except(:a, :b) # => { c: nil }
+ # hash # => { a: true, b: false, c: nil }
#
# This is useful for limiting a set of parameters to everything but a few known toggles:
# @person.update(params[:person].except(:admin))
@@ -10,10 +11,10 @@ class Hash
dup.except!(*keys)
end
- # Replaces the hash without the given keys.
- # hash = { a: true, b: false, c: nil}
- # hash.except!(:c) # => { a: true, b: false}
- # hash # => { a: true, b: false }
+ # Removes the given keys from hash and returns it.
+ # hash = { a: true, b: false, c: nil }
+ # hash.except!(:c) # => { a: true, b: false }
+ # hash # => { a: true, b: false }
def except!(*keys)
keys.each { |key| delete(key) }
self