Class: Wongi::Engine::DeleteSafeEnumerator

Inherits:
Object
  • Object
show all
Defined in:
lib/wongi-engine/enumerators.rb

Class Method Summary collapse

Class Method Details

.new(collection) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/wongi-engine/enumerators.rb', line 12

def self.new(collection)
  Enumerator.new do |y|
    collection.dup.each do |e|
      y << e unless e.deleted?
    end
    collection.reject! &:deleted?
  end
end