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.
On 01.11.2010 06:54, wroxdb wrote:
how to dump a complicated data structure with ruby?
I believe Marshal and Yaml are what you want.
Kind regards
robert
On Mon, Nov 1, 2010 at 6:54 AM, wroxdb [email protected] wrote:
They didn’t work nice.
Alternatively to YAML, JSON (in Ruby 1.9: require “json”;
data.to_json) could work, too.
–
Phillip G.
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 G. wrote in post #958458:
On Mon, Nov 1, 2010 at 6:54 AM, wroxdb [email protected] 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.
Also awesome print is … pretty awesome too
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs