From e2ec3a642ccdb47ce3f07a780f2cac4d3967465a Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Thu, 22 Feb 2024 14:14:29 +1100 Subject: [PATCH] Style flatten tree logic --- lib/haml_up.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/haml_up.rb b/lib/haml_up.rb index d4eb20fb76..62d29be414 100644 --- a/lib/haml_up.rb +++ b/lib/haml_up.rb @@ -58,9 +58,9 @@ class HamlUp end def flatten_tree(parent) - parent.children.map do |child| - [child] + flatten_tree(child) - end.flatten + parent.children.flat_map do |child| + [child, *flatten_tree(child)] + end end def parse_attributes(string)