4 ms·
Blocks are Proc objects whenever you take their value, and it's only an implementation dependent optimization that they are not that all the time in MRI. It's p
by vidarh 3y ago
Blocks are Proc objects whenever you take their value, and it's only an implementation dependent optimization that they are not that all the time in MRI. It's perfectly viable to implement a Ruby where blocks are always Proc's. You don't need to care about that distinction.
Ruby doesn't have functions at all - it has objects with methods, and you can treat a block as an object whenever you want.