From b32e43808b0217f0737dcc446b80b3aed0691c6c Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sat, 20 Dec 2025 14:25:36 +0100 Subject: [PATCH] Don't mutate a string literal in main code sample I know this is still being debated, but as of the current version of Ruby, the first code sample does emit a deprecation warning (hidden by default but still). I think it's would be better to not mutate a string literal. --- bg/examples/i_love_ruby.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bg/examples/i_love_ruby.md b/bg/examples/i_love_ruby.md index eb6b1c74d2..a86bfeca1a 100644 --- a/bg/examples/i_love_ruby.md +++ b/bg/examples/i_love_ruby.md @@ -8,7 +8,7 @@ say = "I love Ruby" puts say # Output "I *LOVE* RUBY" -say['love'] = "*love*" +say = say.sub("love", "*love*") puts say.upcase # Output "I *love* Ruby"