From 4fa6a5c4e02bf6c511ecda9db4fd61e51634fe06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Lopez=20=F0=9F=91=BE?= Date: Wed, 21 Nov 2018 08:11:07 +0900 Subject: Improve documentation for Hash#slice! --- activesupport/lib/active_support/core_ext/hash/slice.rb | 5 +++-- 1 file 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) -- cgit v1.2.3