Module: Mongoid::Tree::Traversal::ClassMethods

Defined in:
lib/mongoid/tree/traversal.rb

Overview

The methods in this module are class-level methods documented above. They’re extended into the base class automatically.

Instance Method Summary collapse

Instance Method Details

#traverse(type = :depth_first, &block) ⇒ Object

:nodoc:

Raises:

  • (ArgumentError)


78
79
80
81
82
# File 'lib/mongoid/tree/traversal.rb', line 78

def traverse(type = :depth_first, &block)
  raise ArgumentError, "No block given" unless block_given?
  roots.each { |root| root.traverse(type, &block) }
  nil
end