Method: Method#>>
- Defined in:
- proc.c
#>>(g) ⇒ Proc
Returns a proc that is the composition of this method and the given g. The returned proc takes a variable number of arguments, calls this method with them then calls g with the result.
def f(x)
x * x
end
f = self.method(:f)
g = proc {|x| x + x }
p (f >> g).call(2) #=> 8
3666 3667 3668 3669 3670 3671 3672 |
# File 'proc.c', line 3666 static VALUE rb_method_compose_to_right(VALUE self, VALUE g) { g = to_callable(g); self = method_to_proc(self); return proc_compose_to_right(self, g); } |