Project

General

Profile

Actions

Feature #12913

closed

A way to configure the default maximum width of pp

Added by mame (Yusuke Endoh) over 7 years ago. Updated over 2 years ago.

Status:
Closed
Target version:
-
[ruby-core:78062]

Description

How about having an easy way to configure the maximum width of a line of pp output?
Currently, pp accepts the maximum width as an optional argument:

pp(big_array, $>, 120)

However, this is obviously too long for a useful debugging-purpose method like pp. Even worse, we must add the fragment ", $>, 120" to all calls to pp. I don't feel this is reasonable.

The patch attached provides PP.default_maxwidth= and PP.default_maxwidth, which can be used to configure the default setting of the maxwidth.

PP.default_maxwidth = 1
pp([1, 2, 3])
#=> [1,
#    2,
#    3]

Akr-san, what do you think?


Files

pp-default-maxwidth.patch (1.05 KB) pp-default-maxwidth.patch mame (Yusuke Endoh), 11/09/2016 02:59 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0