diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-20 09:58:42 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-20 09:58:42 -0700 |
commit | c317c5b25d9f49d0a0b55ddb93b6997c7673d09f (patch) | |
tree | 58547a6032f0f194d3cb287dcfb682e96187e93b /activesupport | |
parent | 440559f661b55c9cd0492469a31c8b3647ca670a (diff) | |
download | rails-c317c5b25d9f49d0a0b55ddb93b6997c7673d09f.tar.gz rails-c317c5b25d9f49d0a0b55ddb93b6997c7673d09f.tar.bz2 rails-c317c5b25d9f49d0a0b55ddb93b6997c7673d09f.zip |
search private and protected methods for convert_key
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/slice.rb | 4 | ||||
-rw-r--r-- | activesupport/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 fbc6e538d5..45181f0e16 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 @@ class Hash # 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 e4a13870d7..49aa012268 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 <tt>params[:key]</tt> instead of <tt>params['key']</tt> # and they get the same value for both keys. class HashWithIndifferentAccess < Hash - + # Always returns true, so that <tt>Array#extract_options!</tt> finds members of this class. def extractable_options? true |