ruby picture

RCR 214: Object#pretty

Submitted by ahoward (Fri Feb 13 13:02:54 UTC 2004)

Abstract

make pretty_printing more available and easier to use

Problem

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
ruby picture
Comments Current voting
Strongly opposed 0
Opposed 0
Neutral 0
In favor 0
Strongly advocate 0
ruby picture

This RCR has been superseded by RCR 215.

ruby picture

Powered by .