(PUP-3978) Ruby 1.8.x uglifications
A Proc is not passed by reference in Ruby 1.8.x. Instead a new Proc
is created for every call. This means that the closure is lost
and with it, the arity and parameters that makes it possible to
derive the correct Callable type.
This commit rectifies this by creating a block with an arity that
matches the closure. The mapping will be correct up to 10 parameters.
closures with more parameters than 10 will be mapped as varargs.
This fix means that one mistake may go undetected when using Ruby
1.8.x and that is when a function declares the block to take N
parameters and the actual call to that block is passing fewer values.
Ruby will automatically assing nil values to the remaining args
and the preconfigured block will then pass the correct number of
parameters, albeit with nil values for some of them, to the closure
call method which then will consider the call OK with respect to
number of provided parameter values.