8000 book2: fix frozen string literal problem · pragma-git/git-scm@dc24774 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit dc24774

Browse files
committed
book2: fix frozen string literal problem
Book generation has been broken since 6a1d3bc (freeze string literals in rake tasks, 2022-10-05). The issue is the use of force_encoding() on a literal, which doesn't work if it's frozen. One solution would be to just .dup the literal. However, this force_encoding is not necessary at all these days. Since ruby 2.0, strings are UTF8 by default. So we can just get rid of it.
1 parent 484c3bf commit dc24774

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/tasks/book2.rake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def expand(content, path, &get_content)
1313
end
1414
new_content = get_content.call(new_fname)
1515
if new_content
16-
expand(new_content.gsub("\xEF\xBB\xBF".force_encoding("UTF-8"), ""), new_fname) { |c| get_content.call(c) }
16+
expand(new_content.gsub("\xEF\xBB\xBF", ""), new_fname) { |c| get_content.call(c) }
1717
else
1818
puts "#{new_fname} could not be resolved for expansion"
1919
""

0 commit comments

Comments
 (0)
0