Style flatten tree logic

This commit is contained in:
Maikel Linke
2024-02-22 14:14:29 +11:00
parent 66c6994d78
commit e2ec3a642c

View File

@@ -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)