Module: Katalyst::Content::HasTree
- Defined in:
- app/models/concerns/katalyst/content/has_tree.rb
Defined Under Namespace
Classes: Builder
Instance Method Summary collapse
-
#tree ⇒ Object
Constructs a tree from an ordered list of items with depth.
Instance Method Details
#tree ⇒ Object
Constructs a tree from an ordered list of items with depth.
* items that have higher depth than their predecessor are nested as `children`.
* items with the same depth become siblings.
9 10 11 |
# File 'app/models/concerns/katalyst/content/has_tree.rb', line 9 def tree items.reduce(Builder.new, &:add).tree end |