diff options
author | zverok <zverok.offline@gmail.com> | 2019-10-24 19:35:36 +0300 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-26 14:58:08 +0900 |
commit | bddb31bb37f878cf171f89ac54f7e43d7d59c444 (patch) | |
tree | a332274fe4ac60ae0f8a60331769cf78ca3d8805 /proc.c | |
parent | cf9344131c3d0f5993c6d999c427a4c656df30a2 (diff) | |
download | ruby-bddb31bb37f878cf171f89ac54f7e43d7d59c444.tar.gz |
Documentation improvements for Ruby core
* Top-level `return`;
* Documentation for comments syntax;
* `rescue` inside blocks;
* Enhance `Object#to_enum` docs;
* Make `chomp:` option more obvious for `String#each_line` and
`#lines`;
* Enhance `Proc#>>` and `#<<` docs;
* Enhance `Processs` class docs.
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -3291,6 +3291,8 @@ static VALUE rb_proc_compose_to_right(VALUE self, VALUE g); * f = proc {|x| x * x } * g = proc {|x| x + x } * p (f << g).call(2) #=> 16 + * + * See Proc#>> for detailed explanations. */ static VALUE proc_compose_to_left(VALUE self, VALUE g) @@ -3330,6 +3332,20 @@ rb_proc_compose_to_left(VALUE self, VALUE g) * f = proc {|x| x * x } * g = proc {|x| x + x } * p (f >> g).call(2) #=> 8 + * + * <i>g</i> could be other Proc, or Method, or any other object responding to + * +call+ method: + * + * class Parser + * def self.call(text) + * # ...some complicated parsing logic... + * end + * end + * + * pipeline = File.method(:read) >> Parser >> proc { |data| puts "data size: #{data.count}" } + * pipeline.call('data.json') + * + * See also Method#>> and Method#<<. */ static VALUE proc_compose_to_right(VALUE self, VALUE g) |