diff options
author | Daniel Lopez 👾 <daniel@6temes.cat> | 2018-11-21 08:11:07 +0900 |
---|---|---|
committer | Daniel Lopez 👾 <daniel@6temes.cat> | 2018-11-21 08:11:07 +0900 |
commit | 4fa6a5c4e02bf6c511ecda9db4fd61e51634fe06 (patch) | |
tree | e4dea1f7fb32145a9008756597519b0c4c3afdcf /activesupport | |
parent | 218e50ce59c3abfa5ffdfac253cdeb2f74602da0 (diff) | |
download | rails-4fa6a5c4e02bf6c511ecda9db4fd61e51634fe06.tar.gz rails-4fa6a5c4e02bf6c511ecda9db4fd61e51634fe06.tar.bz2 rails-4fa6a5c4e02bf6c511ecda9db4fd61e51634fe06.zip |
Improve documentation for Hash#slice!
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/slice.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb index 2bd0a56ea4..fb5887d57b 100644 --- a/activesupport/lib/active_support/core_ext/hash/slice.rb +++ b/activesupport/lib/active_support/core_ext/hash/slice.rb @@ -27,8 +27,9 @@ class Hash # Replaces the hash with only the given keys. # Returns a hash containing the removed key/value pairs. # - # { a: 1, b: 2, c: 3, d: 4 }.slice!(:a, :b) - # # => {:c=>3, :d=>4} + # hash = { a: 1, b: 2, c: 3, d: 4 } + # hash.slice!(:a, :b) # => {:c=>3, :d=>4 } + # hash # => {:a=>1, :b=>2 } def slice!(*keys) omit = slice(*self.keys - keys) hash = slice(*keys) |