On Nov 20, 11:48 am, Oliver <fwa... / gmail.com> wrote:
> hi, folks -
>
> how do I save the output from pp to a string for later use?

irb(main):001:0> require 'pp'
=> true

irb(main):002:0> h = {('a'*60)=>['b'*60,'c'*60],
('d'*60)=>['e'*60,'f'*60]}
=>
{"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"=>["eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"=>["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"]}

irb(main):003:0> pp h
{"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"=>
  ["eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
   "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],
 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"=>
  ["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"]}
=> nil

irb(main):004:0> str = h.pretty_inspect
=> "{\"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\"=>
\n  [\"eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
eeeeee\",\n
\"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\"],\n
\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaa\"=>\n
[\"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\",\n
\"cccccccccccccccccccccccccccccccccccccc
cccccccccccccccccccccc\"]}\n"

irb(main):005:0> puts str
{"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"=>
  ["eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
   "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"],
 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"=>
  ["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"]}
=> nil