From: Brent Clark on 5 Aug 2010 04:07 Hiya I know we can use JSON, YAML, Marshal etc for representation of the data. Personally I find the above solutions clunky. I would do the job if I could (Still learning Ruby), but im hoping with the spirit of open source and communities, I would like to plead with community for someone to please release a gem like perls Data::Dumper. Hope someone would be so kind as to give me request some thought. Kind Regards Brent Clark
From: Roger Pack on 5 Aug 2010 11:14 Brent Clark wrote: > Hiya > > I know we can use JSON, YAML, Marshal etc for representation of the > data. > > Personally I find the above solutions clunky. > > I would do the job if I could (Still learning Ruby), but im hoping with > the spirit of open source and communities, I would like to plead with > community for someone to please release a gem like perls Data::Dumper. you can try >> print a.inspect or >> p a # same thing or >> require 'pp' >> pp a Do these scratch your itch? -r -- Posted via http://www.ruby-forum.com/.
From: Caleb Clausen on 5 Aug 2010 22:29 On 8/5/10, Brent Clark <brentgclarklist(a)gmail.com> wrote: > Hiya > > I know we can use JSON, YAML, Marshal etc for representation of the data. > > Personally I find the above solutions clunky. > > I would do the job if I could (Still learning Ruby), but im hoping with the > spirit of open source and communities, I would like to plead with community > for someone to please release a gem like perls Data::Dumper. > > Hope someone would be so kind as to give me request some thought. I wrote a gem called Ron (note capitalization; if you use lowercase spelling, you'll get something else) which serializes ruby data structures as ruby code which can be eval'd to get back the original data. Seems to be exactly what you're asking for. There's also amarshal, which serializes ruby data as ruby code that reconstructs it, but it's not as declarative (it emits a series of statements which reconstruct the object, instead of a single expression) and therefore (IMNSHO) not as pretty.
From: David Masover on 8 Aug 2010 03:22 On Thursday, August 05, 2010 03:07:39 am Brent Clark wrote: > Hiya > > I know we can use JSON, YAML, Marshal etc for representation of the data. > > Personally I find the above solutions clunky. How so? I mainly used Dumper in Perl for two reasons: - I wasn't aware of easy options for JSON/YAML/etc for storing data. - I wanted to see what was actually going on in my objects. So I'm curious, because I prefer the above solutions to something executable for the purposes of data storage and transfer -- the only place I'd prefer this is when #inspect isn't doing a good enough job for investigating stuff in irb.
|
Pages: 1 Prev: Unknown character print on irb or command prompt Next: Output and return value |