Merge pull request #42141 from ashiksp/double-quotes

This commit is contained in:
Zachary Scott 2021-05-04 23:06:07 +09:00 committed by GitHub
commit 84643885cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 7 deletions

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