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

Updated #quote comments and removed if-else block.

This commit is contained in:
Ashik Salman 2021-05-04 16:43:34 +05:30
parent daaa3b5868
commit 71437f620f

View file

@ -323,8 +323,7 @@ module Rails
end
end
# Surround string with single quotes if there is no quotes.
# Otherwise fall back to double quotes
# Always returns value in double quotes.
def quote(value) # :doc:
if value.respond_to? :each_pair
return value.map do |k, v|
@ -333,11 +332,7 @@ module Rails
end
return value.inspect unless value.is_a? String
if value.include?("'")
value.tr("'", '"')
else
"\"#{value}\""
end
"\"#{value.tr("'", '"')}\""
end
# Returns optimized string with indentation