-
Notifications
You must be signed in to change notification settings - Fork 176
Ruby 3.4 frozen string literal deprecation warnings #253
Copy link
Copy link
Open
Description
Description
When using combine_pdf with Ruby 3.4, deprecation warnings are emitted about frozen string literals.
Warning message
lib/combine_pdf/parser.rb:730: warning: string returned by :__WKANCHOR_2.to_s will be frozen in the future
Environment
- Ruby version: 3.4.x
- combine_pdf version: 1.0.31
Root cause
In Ruby 3.4, Symbol#to_s returns a frozen string. The code at line 730 of lib/combine_pdf/parser.rb likely modifies the result of to_s called on a symbol, which triggers this deprecation warning.
Suggested fix
When modifying a string returned by Symbol#to_s, create a mutable copy first:
# Instead of:
sym.to_s.prepend('_')
# Use:
"_#{sym}"
# or
sym.to_s.dup.prepend('_')This is similar to the fix applied in other gems like marcel (rails/marcel#140).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels