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
|
||
|---|---|---|
| .. | ||
| benchmarks | ||
| bulk_import | ||
| demon_test | ||
| import_scripts | ||
| .gitignore | ||
| alice.txt | ||
| analyze_sidekiq_queues.rb | ||
| bench.rb | ||
| biggest_objects.rb | ||
| boot_mem.rb | ||
| cache_critical_dns | ||
| check_forking.rb | ||
| compile_hbs.rb | ||
| diff_heaps.rb | ||
| discourse | ||
| docker_test.rb | ||
| downsize_uploads.rb | ||
| measure.rb | ||
| memory-analysis | ||
| memstats.rb | ||
| micro_bench.rb | ||
| mwrap_sidekiq | ||
| plugin-translations.rb | ||
| profile_db_generator.rb | ||
| pull_translations.rb | ||
| push_translations.rb | ||
| rails | ||
| redis_memory.rb | ||
| require_profiler.rb | ||
| switch_container_ruby | ||
| test_email_settings.rb | ||
| test_hbs_compiler.rb | ||
| test_mem.rb | ||
| test_memory_leak.rb | ||
| test_pretty_text.rb | ||
| thread_detective.rb | ||
| user_simulator.rb | ||
| version_bump.rb | ||