mirror of
https://github.com/discourse/discourse.git
synced 2026-08-14 06:55:03 -05: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:
@@ -1,8 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SilenceLogger < Rails::Rack::Logger
|
||||
PATH_INFO = 'PATH_INFO'.freeze
|
||||
HTTP_X_SILENCE_LOGGER = 'HTTP_X_SILENCE_LOGGER'.freeze
|
||||
PATH_INFO = 'PATH_INFO'
|
||||
HTTP_X_SILENCE_LOGGER = 'HTTP_X_SILENCE_LOGGER'
|
||||
|
||||
def initialize(app, opts = {})
|
||||
@app = app
|
||||
@@ -36,9 +36,9 @@ class SilenceLogger < Rails::Rack::Logger
|
||||
end
|
||||
|
||||
silenced = [
|
||||
"/mini-profiler-resources/results".freeze,
|
||||
"/mini-profiler-resources/includes.js".freeze,
|
||||
"/mini-profiler-resources/includes.css".freeze,
|
||||
"/mini-profiler-resources/jquery.tmpl.js".freeze
|
||||
"/mini-profiler-resources/results",
|
||||
"/mini-profiler-resources/includes.js",
|
||||
"/mini-profiler-resources/includes.css",
|
||||
"/mini-profiler-resources/jquery.tmpl.js"
|
||||
]
|
||||
Rails.configuration.middleware.swap Rails::Rack::Logger, SilenceLogger, silenced: silenced
|
||||
|
||||
Reference in New Issue
Block a user