From 15f1349e4e0ee1f8279b9ff5102148d1434aeb23 Mon Sep 17 00:00:00 2001 From: Brandon Weaver Date: Fri, 19 May 2023 14:05:42 -0700 Subject: [PATCH 1/2] Replace Regexp in for headers for perf --- lib/net/http/header.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index 31a54a0b..085c60a4 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -491,7 +491,7 @@ def each_capitalized alias canonical_each each_capitalized def capitalize(name) - name.to_s.split(/-/).map {|s| s.capitalize }.join('-') + name.to_s.split('-').map {|s| s.capitalize }.join('-') end private :capitalize From 826e008cfe2011f68f9994245697c7f756a01c94 Mon Sep 17 00:00:00 2001 From: Brandon Weaver Date: Fri, 19 May 2023 15:06:44 -0700 Subject: [PATCH 2/2] Update lib/net/http/header.rb Co-authored-by: Jean Boussier --- lib/net/http/header.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/net/http/header.rb b/lib/net/http/header.rb index 085c60a4..30c632cc 100644 --- a/lib/net/http/header.rb +++ b/lib/net/http/header.rb @@ -491,7 +491,7 @@ def each_capitalized alias canonical_each each_capitalized def capitalize(name) - name.to_s.split('-').map {|s| s.capitalize }.join('-') + name.to_s.split('-'.freeze).map {|s| s.capitalize }.join('-'.freeze) end private :capitalize