For instance:
a = [1,2,3,4,5] a.delete_if { |x| x > 3 } 
is equivalent to:
 a = [1,2,3,4,5] a.delete_if.each.each.each.each { |x| x > 3 } 
I know that a.delete_if returns an enumerator. But how does he know that he should delete the object when each block returns true? How to implement delete_if manually (and in Ruby)?
source share