From 55cb6d38ae3604f4ea4f1a91cab8f32f93fe6633 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Sat, 16 Dec 2023 08:07:03 +0100 Subject: [PATCH] Remove unnecessary `.compact` call (#562) The `.compact` method is used to remove nil elements from an array. However, in this context, it is unnecessary because the `.map` operation is already creating an array of strings, and there's no `nil` values that could be removed --- lib/arbre/html/attributes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/arbre/html/attributes.rb b/lib/arbre/html/attributes.rb index dbbd1a3..29e1113 100644 --- a/lib/arbre/html/attributes.rb +++ b/lib/arbre/html/attributes.rb @@ -6,7 +6,7 @@ class Attributes < Hash def to_s flatten_hash.compact.map do |name, value| "#{html_escape(name)}=\"#{html_escape(value)}\"" - end.compact.join ' ' + end.join ' ' end protected