aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorMatthewRudy <MatthewRudyJacobs@gmail.com>2008-07-17 13:58:42 +0100
committerPratik Naik <pratiknaik@gmail.com>2008-07-17 15:34:51 +0100
commit7e8aee7e6cbd23c1eb18bec1869465e923915e7a (patch)
tree03a8ae8f0e11c58683ee12491935986d55302674 /activesupport/lib/active_support
parentb3a2ee7b87a6b2a4c6ff086644f40a472a676b65 (diff)
downloadrails-7e8aee7e6cbd23c1eb18bec1869465e923915e7a.tar.gz
rails-7e8aee7e6cbd23c1eb18bec1869465e923915e7a.tar.bz2
rails-7e8aee7e6cbd23c1eb18bec1869465e923915e7a.zip
Add extra tests to ensure Hash#slice works with an array as a key. #613
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/hash/slice.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb
index be4dec6e53..3f14470f36 100644
--- a/activesupport/lib/active_support/core_ext/hash/slice.rb
+++ b/activesupport/lib/active_support/core_ext/hash/slice.rb
@@ -9,6 +9,11 @@ module ActiveSupport #:nodoc:
# end
#
# search(options.slice(:mass, :velocity, :time))
+ #
+ # If you have an array of keys you want to limit to, you should splat them:
+ #
+ # valid_keys = [:mass, :velocity, :time]
+ # search(options.slice(*valid_keys))
module Slice
# Returns a new hash with only the given keys.
def slice(*keys)