News for hackers. Stuff that matters.
Re:(1..100).inject(&:+) by gregwebs on Monday February 25, 2008 @10:27PM (#123597)
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

There are no comments on this comment yet.