From 0ea6529964fd3f139c67082a497ad1efd71a7684 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Tue, 19 May 2026 13:25:18 +0200 Subject: [PATCH] Fix compatibility with `--enable-frozen-string-literal` This has been a supported option of Ruby since Ruby 2.3, and even without it, mutating a string literal emits a warning. --- .github/workflows/ruby.yml | 4 ++++ lib/docx/containers/paragraph.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 056a003..6f9d6e7 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,6 +22,7 @@ jobs: - 3.2 - 3.3 - 3.4 + - 4.0 - head steps: @@ -36,3 +37,6 @@ jobs: env: COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} run: bundle exec rake spec + env: + RUBYOPT: "--enable-frozen-string-literal --debug-frozen-string-literal" + diff --git a/lib/docx/containers/paragraph.rb b/lib/docx/containers/paragraph.rb index f51496e..536e8bf 100755 --- a/lib/docx/containers/paragraph.rb +++ b/lib/docx/containers/paragraph.rb @@ -44,7 +44,7 @@ def to_s # Return paragraph as a

HTML fragment with formatting based on properties. def to_html - html = '' + html = +'' text_runs.each do |text_run| html << text_run.to_html end