3 ms·
actually, brackets represent a block. A block is converted to class Proc with '&'. If the object that '&' is used on is not a block, Ruby will first attempt t
by gregwebs 19y ago
actually, brackets represent a block. A block is converted to class Proc with '&'. If the object that '&' is used on is not a block, Ruby will first attempt to convert it into a Proc by calling to_proc
A Ruby block is always associated with a method, and cannot be captured in a variable without converting it back into a proc. This is done by 'removing' the '&'
def return_block &block
return block
end