how to dump a complicated data structure with ruby?
I wrote:
p data
or:
puts data.inspect
They didn't work nice.
Thanks.
how to dump a complicated data structure with ruby?
I wrote:
p data
or:
puts data.inspect
They didn't work nice.
Thanks.
I believe Marshal and Yaml are what you want.
Kind regards
robert
On 01.11.2010 06:54, wroxdb wrote:
how to dump a complicated data structure with ruby?
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
Alternatively to YAML, JSON (in Ruby 1.9: require "json";
data.to_json) could work, too.
On Mon, Nov 1, 2010 at 6:54 AM, wroxdb <wroxdb@gmail.com> wrote:
how to dump a complicated data structure with ruby?
I wrote:
p data
or:
puts data.inspect
They didn't work nice.
--
Phillip Gawlowski
Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
Phillip Gawlowski wrote in post #958458:
On Mon, Nov 1, 2010 at 6:54 AM, wroxdb <wroxdb@gmail.com> wrote:
They didn't work nice.
Alternatively to YAML, JSON (in Ruby 1.9: require "json";
data.to_json) could work, too.
There is also pp / prettyprint in the standard library.
--
Posted via http://www.ruby-forum.com/\.
Also awesome print is ... pretty awesome too GitHub - michaeldv/awesome_print
On Nov 2, 2010, at 9:26 PM, Brian Candler wrote:
Phillip Gawlowski wrote in post #958458:
On Mon, Nov 1, 2010 at 6:54 AM, wroxdb <wroxdb@gmail.com> wrote:
They didn't work nice.
Alternatively to YAML, JSON (in Ruby 1.9: require "json";
data.to_json) could work, too.There is also pp / prettyprint in the standard library.
--
Posted via http://www.ruby-forum.com/\.