Methods
Constants
MethodMutexes | = | Hash.new do |hash, key| hash[key] = Mutex.new |
Public Instance methods
Alias for compose
Returns a new proc that is the functional compostion of two procs, in order.
a = lambda { |x| x + 4 } b = lambda { |y| y / 2 } a.compose(b).call(4) #=> 6 b.compase(a).call(4) #=> 4
This method is also aliased as
*
[ show source ]
# File lib/facets/core/proc/compose.rb, line 15 def compose(other) raise ArgumentError, "arity count mismatch" unless arity == other.arity #proc{ |*a| self.call(other.call(*a)) } proc{ |*a| self.call(*other.call(*a)) } end