Skip to content

Add #frozen_string_literal: true to all files #599

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

moberegger
Copy link

Simply adds #frozen_string_literal: true to all files. No idea why these were missing. Don't think this will make a huge difference, but it can't hurt.

Are these necessary/useful for Rakefile, Gemfile, etc? This PR includes them, but not 100% sure if that's correct.

We can also consider configuring action_view.frozen_string_literal = true in the railtie. Something like

config.before_configuration do |app|
  # Makes is so that string literals are frozen and interned in our jbuilder templates to save
  # on memory allocations.
  app.config.action_view.frozen_string_literal = true
end

Not sure if this is something that jbuilder should force, but I think this is something you will generally want. Wouldn't surprise me if there are users of the gem that are unaware that strings in their templates aren't being interned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant