m***@ruby-lang.org
2021-05-25 04:44:08 UTC
Issue #12913 has been updated by mame (Yusuke Endoh).
Assignee changed from akr (Akira Tanaka) to nobu (Nobuyoshi Nakada)
Status changed from Rejected to Assigned
I prefer @nobu's patch to mine. Since it was fine to @akr, how about committing it?
----------------------------------------
Feature #12913: A way to configure the default maximum width of pp
https://bugs.ruby-lang.org/issues/12913#change-92156
* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
----------------------------------------
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)
Assignee changed from akr (Akira Tanaka) to nobu (Nobuyoshi Nakada)
Status changed from Rejected to Assigned
What about this?
* affects `PP.pp` and `Kernel#pp` only
* try console window size, `COLUMNS` environment variable, then old good 80
It seems fine.* affects `PP.pp` and `Kernel#pp` only
* try console window size, `COLUMNS` environment variable, then old good 80
----------------------------------------
Feature #12913: A way to configure the default maximum width of pp
https://bugs.ruby-lang.org/issues/12913#change-92156
* Author: mame (Yusuke Endoh)
* Status: Assigned
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
----------------------------------------
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)
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-***@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>