Proc
Proc is a procedure object in which both a block and its context (local variable scope and stack frame) have been encapsulated as an object. Proc can be used like an unnamed function, except that it does not have its own local variable scope.
We can see that Proc retains a local variable scope, however, by observing that the variable var can be referenced, as in the example below:
Superclass
Object
Class Method
Proc.newProc.new { ... }
Encapsulates a block, along with its context, into an object and returns it.
If no block is specified, but the method that called Proc.new contains a block, that block will be created as a Proc object and returned.
Method
call(arg ... )
Executes a procedure object and returns the result. Arguments are assigned to block parameters as is (according to the rules of multiple assignation).
Last updated