ruby-changes:45750
From: stomar <ko1@a...>
Date: Fri, 10 Mar 2017 04:48:15 +0900 (JST)
Subject: [ruby-changes:45750] stomar:r57823 (trunk): object.c: [DOC] simplify Object#tap example
stomar 2017-03-10 04:48:09 +0900 (Fri, 10 Mar 2017) New Revision: 57823 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57823 Log: object.c: [DOC] simplify Object#tap example Modified files: trunk/object.c Index: object.c =================================================================== --- object.c (revision 57822) +++ object.c (revision 57823) @@ -748,16 +748,16 @@ rb_class_search_ancestor(VALUE cl, VALUE https://github.com/ruby/ruby/blob/trunk/object.c#L748 /* * call-seq: - * obj.tap{|x|...} -> obj + * obj.tap{|x| block } -> obj * * Yields self to the block, and then returns self. * The primary purpose of this method is to "tap into" a method chain, * in order to perform operations on intermediate results within the chain. * - * (1..10) .tap {|x| puts "original: #{x.inspect}"} - * .to_a .tap {|x| puts "array: #{x.inspect}"} - * .select {|x| x%2==0} .tap {|x| puts "evens: #{x.inspect}"} - * .map {|x| x*x} .tap {|x| puts "squares: #{x.inspect}"} + * (1..10) .tap {|x| puts "original: #{x}" } + * .to_a .tap {|x| puts "array: #{x}" } + * .select {|x| x.even? } .tap {|x| puts "evens: #{x}" } + * .map {|x| x*x } .tap {|x| puts "squares: #{x}" } * */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/