html2markdown
html2markdown copied to clipboard
Converter code produces "literal string will be frozen in the future" warnings
Greetings 👋
Running this gem produces the warnings like this one:
html2markdown/lib/html2markdown/converter.rb:54: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information)
With this change in Ruby 3.4.1 all string literals behave like they are frozen (which will likely happen by default in next Ruby iterations). The solution is to either disable strings freezing on per-file basis or adjust the code to no longer produce the frozen strings where they are modified.
Steps: To reproduce the warnings:
> bundle exec rspec --warnings
To see the failures from upcoming behaviour:
> RUBYOPT='--enable=frozen-string-literal' bundle exec rspec
Expected result: All tests pass.
Actual result: All tests fail with an errors like FrozenError: can't modify frozen String: "".
Ruby version:
> ruby -v
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-darwin22]