Commit ffe4341
authored
Fix FrozenError when parsing ERB files in Ruby 4.0 (#118)
Running `rake gettext:find` on Ruby 4.0 projects fails with the
following error:
```
FrozenError: can't modify frozen String: "#coding:UTF-8\n_erbout = +''; _erbout.<< "<h2>".freeze;
```
In Ruby 4.0, `ERB#src` now returns a frozen String.
`GetText::ErbParser#parse` calls src.force_encoding(encoding) directly
on that value, which raises a FrozenError.
To fix that, we're using the unary + operator (`+erb.src`) to get a
mutable copy of the string.1 parent 45228ed commit ffe4341
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
| 73 | + | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
0 commit comments