Sha256: 88a4ad03b56e88ad4f75546b43dd985a700e4d435fd0d16a21f9c8b4769d22b2
Contents?: true
Size: 592 Bytes
Versions: 10
Compression:
Stored size: 592 Bytes
Contents
require 'facets/na' class Proc # Convert a Proc object into new partial Proc object. # # a = proc { |a,b,c| a+b+c } # b = a.partial(NA,2,NA) # b[1,3] #=> 6 # # Note, the #__ method, which used to be used in stay of NA, # has been deprecated. # #-- # a = proc { |a,b,c| a+b+c } # b = a.partial(__,2,__) # b[1,3] #=> 6 #++ # # This method is similar to Proc#curry. # # CREDT Trans def partial(*args) Proc.new do |*spice| result = args.collect do |a| NA == a ? spice.pop : a end call(*result) end end end
Version data entries
10 entries across 9 versions & 2 rubygems