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:
commit
ccda54a925
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue