From 4835955d1b8a22160017bdf738d59bc0483d5e95 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Fri, 15 Dec 2023 08:06:20 +0100 Subject: [PATCH] Remove unnecessary `.compact` call 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