[ruby] what is this code doing
What is the "self"? It is not defined anywhere in the example. What does .call mean? It looks like it is returning an element in an array here. Is this correct?
class Array
def eachEven(&wasABlock_nowAProc)
even.
isEven = true
self.each do |object|
if isEven
wasABlock_nowAProc.call object
end
isEven = (not isEven)
end
end
end
Posted Feb 22, 2016, 4:58 AM UTC
26