Skip to content

Commit cfb324e

Browse files
committed
[DOC] Improve docs for Method#>>
1 parent 9f8231b commit cfb324e

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

proc.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4073,17 +4073,16 @@ rb_method_compose_to_left(VALUE self, VALUE g)
40734073
* call-seq:
40744074
* self >> g -> a_proc
40754075
*
4076-
* Returns a proc that is the composition of this method and the given <i>g</i>.
4077-
* The returned proc takes a variable number of arguments, calls this method
4078-
* with them then calls <i>g</i> with the result.
4076+
* Returns a proc that is the composition of this method and the given +g+.
40794077
*
4080-
* def f(x)
4081-
* x * x
4082-
* end
4078+
* The returned proc takes a variable number of arguments. It first calls +self+
4079+
* with the arguments, then calls +g+ with the return value of +self+.
4080+
*
4081+
* def f(ary) = ary << 'in f'
40834082
*
40844083
* f = self.method(:f)
4085-
* g = proc {|x| x + x }
4086-
* p (f >> g).call(2) #=> 8
4084+
* g = proc { |ary| ary << 'in proc' }
4085+
* (f >> g).call([]) # => ["in f", "in proc"]
40874086
*/
40884087
static VALUE
40894088
rb_method_compose_to_right(VALUE self, VALUE g)

0 commit comments

Comments
 (0)