Skip to content

Commit 6038c31

Browse files
committed
♻️ Generate same stringprep tables with ruby 3.4
Ruby 3.4 changed its `Hash#inspect` representation (for the better). So, every time I run rake (after switching to a branch that updates mtimes on related files), this file is converted to the ruby 3.4+ format. This commit normalizes the output. It uses the older format simply to keep the diff small. Next time we update the stringprep code, we can switch to the ruby 3.4+ format.
1 parent f76d433 commit 6038c31

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

rakelib/string_prep_tables_generator.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,11 @@ def asgn_table(name, negate: false)
388388
end
389389

390390
def asgn_mapping(name, replacement = to_map(tables[name]))
391+
indent = " " * 2
392+
replacement = replacement.inspect.gsub(/" => "/, '"=>"')
391393
cname = name.tr(?., ?_).upcase
392-
"# Replacements for %s\n%s%s = %p.freeze" % [
393-
"IN_#{name}", " " * 2, "MAP_#{cname}", replacement,
394+
"# Replacements for %s\n%s%s = %s.freeze" % [
395+
"IN_#{name}", indent, "MAP_#{cname}", replacement,
394396
]
395397
end
396398

0 commit comments

Comments
 (0)