mirror of
https://github.com/discourse/discourse.git
synced 2025-06-03 19:23:22 +08:00
DEV: stop freezing frozen strings
We have the `# frozen_string_literal: true` comment on all our files. This means all string literals are frozen. There is no need to call #freeze on any literals. For files with `# frozen_string_literal: true` ``` puts %w{a b}[0].frozen? => true puts "hi".frozen? => true puts "a #{1} b".frozen? => true puts ("a " + "b").frozen? => false puts (-("a " + "b")).frozen? => true ``` For more details see: https://samsaffron.com/archive/2018/02/16/reducing-string-duplication-in-ruby
This commit is contained in:
@ -121,14 +121,14 @@ module FileStore
|
||||
File.extname(upload.original_filename)
|
||||
end
|
||||
|
||||
get_path_for("original".freeze, upload.id, upload.sha1, extension)
|
||||
get_path_for("original", upload.id, upload.sha1, extension)
|
||||
end
|
||||
|
||||
def get_path_for_optimized_image(optimized_image)
|
||||
upload = optimized_image.upload
|
||||
version = optimized_image.version || 1
|
||||
extension = "_#{version}_#{optimized_image.width}x#{optimized_image.height}#{optimized_image.extension}"
|
||||
get_path_for("optimized".freeze, upload.id, upload.sha1, extension)
|
||||
get_path_for("optimized", upload.id, upload.sha1, extension)
|
||||
end
|
||||
|
||||
CACHE_DIR ||= "#{Rails.root}/tmp/download_cache/"
|
||||
|
Reference in New Issue
Block a user