diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-05 15:50:43 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-05 15:50:43 +0000 |
commit | c5b3196ed4471b92e8602e026c05c630d38df8c7 (patch) | |
tree | 4f28e935225b929579ef6bd271357ca335de1e6d | |
parent | 9f45dc126cc461b78984383f4c15bfdc80b1f6d5 (diff) | |
download | ruby-c5b3196ed4471b92e8602e026c05c630d38df8c7.tar.gz |
* lib/prettyprint.rb (PrettyPrint#first?): obsoleted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/prettyprint.rb | 35 |
2 files changed, 36 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Fri Feb 6 00:48:37 2004 Tanaka Akira <akr@m17n.org> + + * lib/prettyprint.rb (PrettyPrint#first?): obsoleted. + Thu Feb 5 23:56:55 2004 Tanaka Akira <akr@m17n.org> * lib/prettyprint.rb (PrettyPrint#seplist): added. diff --git a/lib/prettyprint.rb b/lib/prettyprint.rb index 6f2c8ea7cc..25e24f6618 100644 --- a/lib/prettyprint.rb +++ b/lib/prettyprint.rb @@ -94,8 +94,36 @@ non-string formatting, etc. --- flush outputs buffered data. +--- seplist(list[, separator_proc[, iter_method]]) {|elt| ... } + adds a separated list. + The list is separated by comma with breakable space, by default. + + seplist iterates the ((|list|)) using ((|iter_method|)). + It yields each object to the block given for seplist. + The procedure ((|separator_proc|)) is called between each yields. + + If the iteration is zero times, ((|separator_proc|)) is not called at all. + + If ((|separator_proc|)) is nil or not given, + (({lambda { comma_breakable }})) is used. + If ((|iter_method|)) is not given, (({:each})) is used. + + For example, following 3 code fragments has similar effect. + + q.seplist([1,2,3]) {|v| xxx v } + + q.seplist([1,2,3], lambda { comma_breakable }, :each) {|v| xxx v } + + xxx 1 + q.comma_breakable + xxx 2 + q.comma_breakable + xxx 3 + --- first? - is a predicate to test the call is a first call to (({first?})) with + first? is obsoleted at 1.8.2. + + first? is a predicate to test the call is a first call to (({first?})) with current group. It is useful to format comma separated values as: @@ -114,10 +142,10 @@ non-string formatting, etc. == References Christian Lindig, Strictly Pretty, March 2000, -((<URL:http://www.gaertner.de/~lindig/papers/strictly-pretty.html>)) +((<URL:http://www.st.cs.uni-sb.de/~lindig/papers/#pretty>)) Philip Wadler, A prettier printer, March 1998, -((<URL:http://www.research.avayalabs.com/user/wadler/topics/recent.html#prettier>)) +((<URL:http://homepages.inf.ed.ac.uk/wadler/topics/language-design.html#prettier>)) == AUTHOR Tanaka Akira <akr@m17n.org> @@ -173,6 +201,7 @@ class PrettyPrint end def first? + warn "PrettyPrint#first? is obsoleted at 1.8.2." current_group.first? end |