diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-20 09:58:42 -0700 |
---|---|---|
committer | Prem Sichanugrist <s@sikac.hu> | 2013-02-24 16:32:25 -0500 |
commit | 7cc26fd15e27c4a13705a844538bebfdd0461729 (patch) | |
tree | 58b878607b9e3e1e77155530e6f33a7570d5b375 /activesupport/lib/active_support/core_ext/hash | |
parent | 45e9cac12ca99a51ef10e5ee423a6712818ae145 (diff) | |
download | rails-7cc26fd15e27c4a13705a844538bebfdd0461729.tar.gz rails-7cc26fd15e27c4a13705a844538bebfdd0461729.tar.bz2 rails-7cc26fd15e27c4a13705a844538bebfdd0461729.zip |
search private and protected methods for convert_key
Diffstat (limited to 'activesupport/lib/active_support/core_ext/hash')
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/indifferent_access.rb | 1 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/hash/slice.rb | 4 |
2 files changed, 2 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb index 7d54c9fae6..e5042c6c18 100644 --- a/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +++ b/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb @@ -1,7 +1,6 @@ require 'active_support/hash_with_indifferent_access' class Hash - # Returns an <tt>ActiveSupport::HashWithIndifferentAccess</tt> out of its receiver: # # {:a => 1}.with_indifferent_access["a"] # => 1 diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb index 0484d8e5d8..a983cae39e 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 = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) + keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true) hash = self.class.new keys.each { |k| hash[k] = self[k] if has_key?(k) } hash @@ -23,7 +23,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 = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key) + keys = keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true) omit = slice(*self.keys - keys) hash = slice(*keys) replace(hash) |