* lib/prettyprint.rb (PrettyPrint#first?): obsoleted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2004-02-05 15:50:43 +00:00
Родитель ed12430398
Коммит 7011dce58e
2 изменённых файлов: 36 добавлений и 3 удалений

Просмотреть файл

@ -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.

Просмотреть файл

@ -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