Permalink
Browse files

search private and protected methods for convert_key

  • Loading branch information...
tenderlove authored and sikachu committed Mar 20, 2012
1 parent 45e9cac commit 7cc26fd15e27c4a13705a844538bebfdd0461729
@@ -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
@@ -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)

This comment has been minimized.

Show comment
Hide comment
@admtnnr

admtnnr Sep 19, 2013

(from @raggi) this is a bug, as activesupport::orderedoptions does not support this

@admtnnr

admtnnr Sep 19, 2013

(from @raggi) this is a bug, as activesupport::orderedoptions does not support this

This comment has been minimized.

Show comment
Hide comment
@douglaslise

douglaslise May 14, 2014

Was not this fixed yet on Rails 3.2.x ? I am referring to the bug on OrderedOptions

@douglaslise

douglaslise May 14, 2014

Was not this fixed yet on Rails 3.2.x ? I am referring to the bug on OrderedOptions

hash = self.class.new
keys.each { |k| hash[k] = self[k] if has_key?(k) }
hash
@@ -23,7 +23,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 = 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)
@@ -6,7 +6,7 @@
module ActiveSupport
class HashWithIndifferentAccess < Hash
-
+
# Always returns true, so that <tt>Array#extract_options!</tt> finds members of this class.
def extractable_options?
true

0 comments on commit 7cc26fd

Please sign in to comment.