Use Symbol#name if available in HashWithIndifferentAccess
This is an old feature request that landed on ruby-head
eb67c603ca
This method returns an interned string, so saves an
allocation.
This commit is contained in:
parent
7af59e16a2
commit
25b80190f0
|
@ -363,8 +363,14 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
private
|
||||
def convert_key(key)
|
||||
key.kind_of?(Symbol) ? key.to_s : key
|
||||
if Symbol.method_defined?(:name)
|
||||
def convert_key(key)
|
||||
key.kind_of?(Symbol) ? key.name : key
|
||||
end
|
||||
else
|
||||
def convert_key(key)
|
||||
key.kind_of?(Symbol) ? key.to_s : key
|
||||
end
|
||||
end
|
||||
|
||||
def convert_value(value, conversion: nil)
|
||||
|
|
Loading…
Reference in New Issue