diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-27 06:27:20 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-06-27 06:27:20 +0000 |
commit | e50f2d285fd88913fc34caef6f0ad8232d3b386b (patch) | |
tree | 117ed6834cc70d043d63c670fa73b39b182367b1 /lib/pp.rb | |
parent | 264d2e4da91c6c8fe04442b447647726710e0cde (diff) |
* lib/prettyprint.rb: re-implemented for incremental output to handle
huge data. API is changed a bit.
* lib/pp.rb: adapt new pretty printing API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/pp.rb')
-rw-r--r-- | lib/pp.rb | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -57,8 +57,8 @@ I like the latter. If you do too, this library is for you. It returns (({nil})). -== Customized output -To define your customized pretty printing function for your class, +== Output Customization +To define your customized pretty printing function for your classes, redefine a method (({pretty_print(((|pp|)))})) in the class. It takes an argument ((|pp|)) which is an instance of the class ((<PP>)). The method should use PP#text, PP#breakable, PP#nest, PP#group and @@ -118,9 +118,9 @@ end class PP < PrettyPrint def PP.pp(obj, width=79, out=$>) - pp = PP.new + pp = PP.new(out, width) pp.guard_inspect_key {pp.pp obj} - pp.format(out, width) + pp.flush #$pp = pp out << "\n" end @@ -134,7 +134,7 @@ class PP < PrettyPrint @@sharing_detection = val end - def initialize + def initialize(out, width=79) super @sharing_detection = @@sharing_detection end |