1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #15448 from akshay-vishnoi/doc_changes

[ci skip] Correct output of Hash#symbolize_keys
This commit is contained in:
Carlos Antonio da Silva 2014-05-31 14:57:21 -03:00
commit ccda54a925

View file

@ -27,7 +27,7 @@ class Hash
# hash = { name: 'Rob', age: '28' }
#
# hash.stringify_keys
# # => { "name" => "Rob", "age" => "28" }
# # => {"name"=>"Rob", "age"=>"28"}
def stringify_keys
transform_keys{ |key| key.to_s }
end
@ -44,7 +44,7 @@ class Hash
# hash = { 'name' => 'Rob', 'age' => '28' }
#
# hash.symbolize_keys
# # => { name: "Rob", age: "28" }
# # => {:name=>"Rob", :age=>"28"}
def symbolize_keys
transform_keys{ |key| key.to_sym rescue key }
end