From c518f54ff2ce07d49811bf33368cd3fdec287008 Mon Sep 17 00:00:00 2001 From: Nicolas Rodriguez Date: Fri, 12 Jan 2024 00:57:17 +0100 Subject: [PATCH] Fix FrozenError: can't modify frozen String: "google" (FrozenError) when running ping_search_engines Backtrace: FrozenError: can't modify frozen String: "google" (FrozenError) /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.2.0/bundler/gems/sitemap_generator-426a0b86cb56/lib/sitemap_generator/utilities.rb:145:in `gsub!' /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.2.0/bundler/gems/sitemap_generator-426a0b86cb56/lib/sitemap_generator/utilities.rb:145:in `titleize' /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.2.0/bundler/gems/sitemap_generator-426a0b86cb56/lib/sitemap_generator/link_set.rb:296:in `block in ping_search_engines' /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.2.0/bundler/gems/sitemap_generator-426a0b86cb56/lib/sitemap_generator/link_set.rb:294:in `each' /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.2.0/bundler/gems/sitemap_generator-426a0b86cb56/lib/sitemap_generator/link_set.rb:294:in `ping_search_engines' /Users/nicolas/PROJECTS/CONCERTO/concerto/.bundle/ruby/3.2.0/bundler/gems/sitemap_generator-426a0b86cb56/lib/sitemap_generator.rb:44:in `method_missing' /Users/nicolas/PROJECTS/CONCERTO/concerto/app/concepts/system/operation/refresh_sitemap.rb:11:in `refresh_sitemap!' --- lib/sitemap_generator/utilities.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/sitemap_generator/utilities.rb b/lib/sitemap_generator/utilities.rb index aa6e883b..b5980a91 100644 --- a/lib/sitemap_generator/utilities.rb +++ b/lib/sitemap_generator/utilities.rb @@ -142,6 +142,7 @@ def with_warnings(flag) end def titleize(string) + string = string.dup if string.frozen? string.gsub!(/_/, ' ') string.split(/(\W)/).map(&:capitalize).join end