Avoid modifying constant strings

This fixes a ruby 3.4 warning about strings that will
be frozen by default in a future release.
This commit is contained in:
Tom Hughes 2025-02-18 20:14:01 +00:00
parent 5eed367f71
commit 881d0b11b5
2 changed files with 3 additions and 3 deletions

View file

@ -144,7 +144,7 @@ module RichText
end
def truncated_text_content(element)
text = ""
text = String.new
append_text = lambda do |child|
if child.type == :text

View file

@ -23,7 +23,7 @@ module ShortLink
# keep support for old shortlinks which use the @ character, now
# replaced by the ~ character because twitter is horribly broken
# and we can't have that.
str.tr!("@", "~")
str = str.tr("@", "~")
str.each_char do |c|
t = ARRAY.index c
@ -57,7 +57,7 @@ module ShortLink
def encode(lon, lat, z)
code = interleave_bits(((lon + 180.0) * (2**32) / 360.0).to_i,
((lat + 90.0) * (2**32) / 180.0).to_i)
str = ""
str = String.new
# add eight to the zoom level, which approximates an accuracy of
# one pixel in a tile.
((z + 8) / 3.0).ceil.times do |i|