Skip to content

Commit 759187b

Browse files
committed
[DOC] Improve docs for Method#<<
1 parent 7644106 commit 759187b

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
@@ -4050,17 +4050,16 @@ rb_proc_compose_to_right(VALUE self, VALUE g)
40504050
* call-seq:
40514051
* self << g -> a_proc
40524052
*
4053-
* Returns a proc that is the composition of this method and the given <i>g</i>.
4054-
* The returned proc takes a variable number of arguments, calls <i>g</i> with them
4055-
* then calls this method with the result.
4053+
* Returns a proc that is the composition of the given +g+ and this method.
40564054
*
4057-
* def f(x)
4058-
* x * x
4059-
* end
4055+
* The returned proc takes a variable number of arguments. It first calls +g+
4056+
* with the arguments, then calls +self+ with the return value of +g+.
4057+
*
4058+
* def f(ary) = ary << 'in f'
40604059
*
40614060
* f = self.method(:f)
4062-
* g = proc {|x| x + x }
4063-
* p (f << g).call(2) #=> 16
4061+
* g = proc { |ary| ary << 'in proc' }
4062+
* (f << g).call([]) # => ["in proc", "in f"]
40644063
*/
40654064
static VALUE
40664065
rb_method_compose_to_left(VALUE self, VALUE g)

0 commit comments

Comments
 (0)