Skip to content

Fix Ruby 3.4 frozen string warnings in normalize_input#33

Open
mavegaf wants to merge 1 commit intojfairbank:devfrom
mavegaf:dev
Open

Fix Ruby 3.4 frozen string warnings in normalize_input#33
mavegaf wants to merge 1 commit intojfairbank:devfrom
mavegaf:dev

Conversation

@mavegaf
Copy link
Copy Markdown

@mavegaf mavegaf commented Jul 1, 2025

Ruby 3.4 enables frozen string literals by default, which causes warnings when using destructive string methods (like strip! and downcase!) on frozen strings. This commit replaces the usage of input.clone.tap { |str| str.strip!; str.downcase! } with a non-mutating chain input.to_s.strip.downcase, which avoids mutating the original string and eliminates the warnings.

References:

@jonh-favo
Copy link
Copy Markdown

Any plans to review/merge this pull request?

@cavi21
Copy link
Copy Markdown

cavi21 commented Mar 12, 2026

@jfairbank (Thanks for the work on this gem 🙌) would you consider merging this PR?

Since the use of clone persist the frozen state of the string literal, not sure what was the intention with it? and since this method is called for asigning the returned value to a variable the proposed solution is safer and don't require a dup neither, right? or I'm missing something?

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.

4 participants