提交 79b88e0d 编写于 作者: A Akshay Vishnoi

[ci skip] Correct output of Hash#symbolize_keys

上级 b1867187
......@@ -27,7 +27,7 @@ def transform_keys!
# 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 @@ def stringify_keys!
# 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册