instance method
quote
Ruby on Rails 5.2.8.1
Since v4.2.9 PrivateSignature
quote(value)
Surround string with single quotes if there is no quotes. Otherwise fall back to double quotes
Parameters
-
valuereq
Source
# File railties/lib/rails/generators/actions.rb, line 315
def quote(value) # :doc:
return value.inspect unless value.is_a? String
if value.include?("'")
value.inspect
else
"'#{value}'"
end
end
Defined in railties/lib/rails/generators/actions.rb line 315
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Rails::Generators::Actions