Hello all,
PP/PrettyPrint comes in handy when I’m trying to inspect the contents of
large arrays, but what if some elements are short length-wise?
irb(main):001:0> require ‘pp’
=> true
irb(main):002:0> pp (0…20).to_a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20]
=> nil
irb(main):003:0> pp (0…40).to_a
[0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40]
=> nil
This behavior is sort of ridiculous in my opinion. I’d rather have
something
more like:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40]
I’ve looked at the source code and documentation for PrettyPrint and PP
but
I don’t understand how they work, so I’m not really sure how the classes
could be extended so they work how I want them to work. I also tried
numerous Google searches and it seems no one has a problem with the
default
behavior as I do. Can someone give me a hand here or at least point me
in
the right direction?