RCR 214: Object#pretty
submitted by ahoward on Fri Feb 13 2004 08:37:54 AM -0800
Status: superseded
Abstract
make pretty_printing more available and easier to use
Problem
- not helpful:
raise ArgumentError, very_large_hash.inspect
- cumbersome:
s = '' PP::pp very_large_hash, s raise ArgumentError, s
Proposal
creation of Object#pretty method which is analogous to Object#inspect, only returning result of 'pp' instead of the result from 'p'
Analysis
simply add a method
Implementation
class Object def pretty s = '' autoload :PP, 'pp' PP::pp self, s s end end
Add comments here
Back to RCRchive.
RCR Submission page and RCRchive powered by Ruby, Apache, RuWiki (modified), and RubLog