Procs
Reusable block objects.
Reusable Block Objects
A block is not an object on its own, so you cannot store it in a variable. A Proc wraps a block into a real object you can save, pass around, and call later.
greeter = Proc.new { puts "Hello!" }
greeter.call
greeter.callCreating Procs
Two common ways to build a Proc: Proc.new { ... } and the shorter proc { ... } Kernel method. Both produce the same kind of object.
double = proc { |x| x * 2 }
p double.call(5)