From 68ddfec346331004e4b4a5374ee4e60c756d7d5c Mon Sep 17 00:00:00 2001 From: davidflanagan Date: Thu, 8 Nov 2007 08:12:59 +0000 Subject: [PATCH] * object.c: improve docs for Object.tap * ChangeLog: fix bogus dates on my previous entries git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 18 ++++++++++++------ object.c | 12 +++++++++--- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ff6042de52..0971c0ef76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,10 @@ -Thu Nov 8 15:13:56 UTC 2007 David Flanagan +Thu Nov 8 17:09:55 2007 David Flanagan + * object.c: improve docs for Object.tap + * ChangeLog: fix bogus dates on my previous entries + +Thu Nov 8 15:13:56 2007 David Flanagan + +Thu Nov 8 15:13:56 2007 David Flanagan * parse.y: fix segfault with \x escapes in regexps delete unused #if 0 code regions from previous patch @@ -6,20 +12,20 @@ Thu Nov 8 12:12:10 2007 NAKAMURA Usaku * parse.y (parser_read_escape): remove C99/gcc-ism. -Thu Nov 8 07:54:22 UTC 2007 David Flanagan +Thu Nov 8 07:54:22 2007 David Flanagan * parse.y: patch, based on Nobu's, work to support \u escapes also modifications for better coderange detection * test/ruby/test_unicode_escapes.rb: test cases * test/ruby/test_mixed_unicode_escapes.rb: mixed encoding test cases -Thu Nov 8 07:14:37 UTC 2007 David Flanagan +Thu Nov 8 07:14:37 2007 David Flanagan * parse.y (rb_intern3): commented out broken code that prevented correct interning of multi-byte symbols. Without this patch :x==:x is false when x is a multi-byte character. -Thu Nov 8 07:04:31 UTC 2007 David Flanagan +Thu Nov 8 07:04:31 2007 David Flanagan * string.c (tr_setup_table, tr_trans): fix test failures in test/ruby/test_string.rb @@ -176,7 +182,7 @@ Thu Nov 1 21:56:45 2007 Yukihiro Matsumoto * error.c (Init_Exception): make SecurityError to be subclass of Exception, since it's too important to be handled implicitly. -Thu Nov 1 14:51:39 UTC 2007 David Flanagan +Thu Nov 1 14:51:39 2007 David Flanagan * enum.c (take_while_i, drop_while_i) add RTEST to handle nil return Thu Nov 1 02:12:50 2007 NAKAMURA Usaku @@ -259,7 +265,7 @@ Fri Oct 26 15:00:52 2007 Nobuyoshi Nakada * misc/ruby-style.el (ruby-style-{case,label}-indent): adjust for labels inside switch block. -Fri Oct 26 05:48:57 UTC 2007 David Flanagan +Fri Oct 26 05:48:57 2007 David Flanagan * array.c: raise IndexError for negative length in rb_ary_fill Wed Oct 25 07:12:03 2007 James Edward Gray II diff --git a/object.c b/object.c index 660c9e1fe1..5bb9a7cd03 100644 --- a/object.c +++ b/object.c @@ -448,9 +448,15 @@ rb_obj_is_kind_of(VALUE obj, VALUE c) * call-seq: * obj.tap{|x|...} => obj * - * Returns the receiver after executing the block given. Its main - * purpose is to be inseted in the method chain. - * + * Yields x to the block, and then returns x. + * 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}"} + * */ VALUE