boazsegev / combine_pdf

A Pure ruby library to merge PDF files, number pages and maybe more...
MIT License
733 stars 154 forks source link

Add compatibility with --enable-frozen-string-literal #239

Open casperisfine opened 4 months ago

casperisfine commented 4 months ago

Fix: https://github.com/boazsegev/combine_pdf/pull/168 Ref: https://bugs.ruby-lang.org/issues/20205

Ruby 3.4 will emit deprecation warnings when mutating string literals, and a future version is likely to make frozen string literals the default.

cc @boazsegev

casperisfine commented 4 months ago

CI: https://github.com/casperisfine/combine_pdf/actions/runs/8467422100

casperisfine commented 2 months ago

@boazsegev 👋

BenMorganMY commented 1 month ago

Hey @casperisfine I was just trying out this implementation locally and it appears page_methods will need to be updated:

/Users/ben/Repos/combine_pdf/lib/combine_pdf/page_methods.rb:290:in `textbox': can't modify frozen String: "" (FrozenError)

On my local, that's referring to:

      contents << box_stream

https://github.com/boazsegev/combine_pdf/blob/master/lib/combine_pdf/page_methods.rb#L288

casperisfine commented 1 month ago

@BenMorganMY thanks updated. I only relied on the test suite so it appears this wasn't covered.