[#104307] Float truncate — Eustáquio Rangel <eustaquiorangel@...>
Hi!
4 messages
2021/06/16
[ruby-core:104345] [Ruby master Feature#12913] A way to configure the default maximum width of pp
From:
merch-redmine@...
Date:
2021-06-17 14:51:28 UTC
List:
ruby-core #104345
Issue #12913 has been updated by jeremyevans0 (Jeremy Evans).
mame (Yusuke Endoh) wrote in #note-12:
> We discussed this issue in today's dev-meeting. @akr suggested that
>
> 1. To make the default size to be io/console's winsize (width)
> 2. Instead of changing `Kernel#pp`, extend `PP.pp` to accept keywords `out` and `width`
> 3. If we want `width=1`, define another new method like `PP.fully_expanded_pp(obj)` or something (Note that there is already `PP.singleline_pp(obj)`)
>
> and we agreed with them. I'll commit a change for 1 later.
>
> I am happy to create another patch for 2 and 3. Anyone have an idea about the name of `fully_expanded_pp`?
In keeping with the spirit that `Kernel#pp` is more expanded than `Kernel#p`, I suggest `PP.ppp`. :)
----------------------------------------
Feature #12913: A way to configure the default maximum width of pp
https://bugs.ruby-lang.org/issues/12913#change-92567
* 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-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>