Module: Mongoid::Tree::Traversal::ClassMethods
- Defined in:
- lib/mongoid/tree/traversal.rb
Overview
This module implements class methods that will be available on the document that includes Mongoid::Tree::Traversal
Instance Method Summary collapse
-
#traverse(type = :depth_first, &block) ⇒ Object
Traverses the entire tree, one root at a time, using the given traversal method (Default is :depth_first).
Instance Method Details
#traverse(type = :depth_first, &block) ⇒ Object
Traverses the entire tree, one root at a time, using the given traversal method (Default is :depth_first).
See Mongoid::Tree::Traversal for available traversal methods.
77 78 79 |
# File 'lib/mongoid/tree/traversal.rb', line 77 def traverse(type = :depth_first, &block) roots.collect { |root| root.traverse(type, &block) }.flatten end |