Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
Proc#<<
prc << g → a_proc
proc.c
View on GitHub ↗
static VALUE
proc_compose_to_left(VALUE self, VALUE g)
{
return rb_proc_compose_to_left(self, to_callable(g));
}
Returns a proc that is the composition of this proc and the given g. The returned proc takes a variable number of arguments, calls g with them then calls this proc with the result.
Example
f = proc {|x| x * x } g = proc {|x| x + x } p (f << g).call(2) #=> 16
See Proc#>> for detailed explanations.