mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-29 21:17:17 +00:00
Style flatten tree logic
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user