Skip to content

Enable Frozen String Literal in production code#782

Open
tagliala wants to merge 1 commit intomasterfrom
feature/780-fzs
Open

Enable Frozen String Literal in production code#782
tagliala wants to merge 1 commit intomasterfrom
feature/780-fzs

Conversation

@tagliala
Copy link
Collaborator

Close #780

@tagliala
Copy link
Collaborator Author

tagliala commented Dec 29, 2025

I'm a little bit surprised about

      def fetch_manual_template(view_path, file)
        Dir[File.join("{#{view_path.join(",")}}", "{#{file},#{partialized(file)}}" + ".{*.,}rabl")].first
      end

Wasn't expecting this to pass on Ruby < 3.0 🤔


No, this is not surprising at all. string_a + string_b creates a new object

@tagliala tagliala force-pushed the feature/780-fzs branch 2 times, most recently from 2bcee11 to ac81a5a Compare January 19, 2026 16:03
@tagliala tagliala changed the title [WIP] Enable Frozen String Literal in production code Enable Frozen String Literal in production code Jan 19, 2026
@tagliala tagliala marked this pull request as ready for review January 19, 2026 16:05
@tagliala tagliala requested a review from Copilot January 19, 2026 16:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request enables frozen string literals in all production code files by adding the # frozen_string_literal: true magic comment at the top of each Ruby file in the lib/ directory. This is a best practice in modern Ruby that improves performance and memory usage by preventing string literals from being modified.

Changes:

  • Added # frozen_string_literal: true comment to all 18 Ruby files in the lib/ directory
  • Removed redundant .freeze call on a string literal in lib/rabl/helpers.rb (line 133)
  • Updated CHANGELOG.md to document the frozen string literal support

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/rabl.rb Added frozen string literal pragma
lib/rabl/builder.rb Added frozen string literal pragma
lib/rabl/cache_engine.rb Added frozen string literal pragma
lib/rabl/configuration.rb Added frozen string literal pragma
lib/rabl/digestor.rb Added frozen string literal pragma
lib/rabl/digestor/rails3.rb Added frozen string literal pragma
lib/rabl/digestor/rails41.rb Added frozen string literal pragma
lib/rabl/digestor/rails5.rb Added frozen string literal pragma
lib/rabl/engine.rb Added frozen string literal pragma
lib/rabl/helpers.rb Added frozen string literal pragma and removed redundant .freeze call
lib/rabl/multi_builder.rb Added frozen string literal pragma
lib/rabl/partials.rb Added frozen string literal pragma
lib/rabl/railtie.rb Added frozen string literal pragma
lib/rabl/renderer.rb Added frozen string literal pragma
lib/rabl/sources.rb Added frozen string literal pragma
lib/rabl/template.rb Added frozen string literal pragma
lib/rabl/tracker.rb Added frozen string literal pragma
lib/rabl/version.rb Added frozen string literal pragma
CHANGELOG.md Added entry for version 0.18.0 documenting frozen string literal support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@tagliala tagliala requested a review from nesquena January 19, 2026 16:11
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.

Enable Frozen String Literal

2 participants