I saw this in some code written by BBC principle developer @kenoir and later located the following useful post: http://mudge.name/2011/01/26/passing-blocks-in-ruby-without-block.html
class Foo
def initialize
bar &Proc.new # voodoo
end
def bar(&block)
block.call
end
end
Foo.new { puts "hai" }
In short, the reason it works is this:
If
Proc.new
is called from inside a method without any arguments of its own, it will return a new Proc containing the block given to its surrounding method.
Very nice!