From c317c5b25d9f49d0a0b55ddb93b6997c7673d09f Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 20 Mar 2012 09:58:42 -0700 Subject: [PATCH] search private and protected methods for convert_key --- activesupport/lib/active_support/core_ext/hash/slice.rb | 4 ++-- .../lib/active_support/hash_with_indifferent_access.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb index fbc6e538d56be..45181f0e1671b 100644 --- a/activesupport/lib/active_support/core_ext/hash/slice.rb +++ b/activesupport/lib/active_support/core_ext/hash/slice.rb @@ -13,7 +13,7 @@ class Hash # valid_keys = [:mass, :velocity, :time] # search(options.slice(*valid_keys)) def slice(*keys) - keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) + keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true) keys.each_with_object(self.class.new) { |k, hash| hash[k] = self[k] if has_key?(k) } end @@ -21,7 +21,7 @@ def slice(*keys) # Returns a hash contained the removed key/value pairs # {:a => 1, :b => 2, :c => 3, :d => 4}.slice!(:a, :b) # => {:c => 3, :d => 4} def slice!(*keys) - keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) + keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true) omit = slice(*self.keys - keys) hash = slice(*keys) replace(hash) diff --git a/activesupport/lib/active_support/hash_with_indifferent_access.rb b/activesupport/lib/active_support/hash_with_indifferent_access.rb index e4a13870d70f7..49aa012268698 100644 --- a/activesupport/lib/active_support/hash_with_indifferent_access.rb +++ b/activesupport/lib/active_support/hash_with_indifferent_access.rb @@ -5,7 +5,7 @@ module ActiveSupport # people can write params[:key] instead of params['key'] # and they get the same value for both keys. class HashWithIndifferentAccess < Hash - + # Always returns true, so that Array#extract_options! finds members of this class. def extractable_options? true