Method: Mongoid::Contextual::Memory#each
- Defined in:
- lib/mongoid/contextual/memory.rb
#each ⇒ Enumerator
Iterate over the context. If provided a block, yield to a Mongoid document for each, otherwise return an enum.
99 100 101 102 103 104 105 106 107 108 |
# File 'lib/mongoid/contextual/memory.rb', line 99 def each if block_given? documents_for_iteration.each do |doc| yield(doc) end self else to_enum end end |