# => {"A" => 2}, in my test, can't rely on this result though
</ruby>
This method may be useful for example to build specialized conversions. For instance +stringify_keys+ and +symbolize_keys+ use +transform_keys+ to perform their key conversions:
<ruby>
def stringify_keys
transform_keys{ |key| key.to_s }
end
...
def symbolize_keys
transform_keys{ |key| key.to_sym rescue key }
end
</ruby>
There's also the bang variant +transform_keys!+ that applies the block operations to keys in the very receiver.
NOTE: Defined in +active_support/core_ext/hash/keys.rb+.
h5. +stringify_keys+ and +stringify_keys!+
The method +stringify_keys+ returns a hash that has a stringified version of the keys in the receiver. It does so by sending +to_s+ to them: