The enumerator will simply allow you to start the block later. For example, if you have a method that specifically handled deletion, if for several different objects, you can pass an enumerator to it.
In the example below, it will print 1, 3, 5
arr = [0,1,2,3,4,5]
enumerator = arr.delete_if
enumerator.each { |el| el.even? }
puts arr.join(', ')
source
share