Skip to content

Commit

Permalink
Remove unnecessary .compact call
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tagliala committed Dec 15, 2023
1 parent 6f8f106 commit 20c8ffb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/arbre/html/attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20c8ffb

Please sign in to comment.