The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Serializing To Ruby Code

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Red Handed

Posts: 1158
Nickname: redhanded
Registered: Dec, 2004

Red Handed is a Ruby-focused group blog.
Serializing To Ruby Code Posted: Jan 6, 2005 5:51 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Red Handed.
Original Post: Serializing To Ruby Code
Feed Title: RedHanded
Feed URL: http://redhanded.hobix.com/index.xml
Feed Description: sneaking Ruby through the system
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Red Handed
Latest Posts From RedHanded

Advertisement

Amid a discussion on the list about XML v. YAML (hope they declare a winner!), I noticed a message by Dick Davies about keeping his data in Ruby code rather than any other data formats. And then I remembered AMarshal. And then I remembered that it’s not in the Ruby stdlib.

AMarshal is a solid extension for saving your objects as straight Ruby. Readable, fast and stable. NaHi’s tested the slime outta this extension. And, well, knowing Tanaka Akira’s consummate debugging… I don’t want to bloat the Ruby dist too much more, but this is a great extension.

 >> require 'amarshal-pretty'
 => true
 >> puts AMarshal.dump_pretty(
 ?>   {'name' => 'Slavoj Zizek', 'alias' => 'Dave Thomas',
 ?>    'authored' => ['PickAxe II', 'The Prag Prog Book']} )
 {"name" => "Slavoj Zizek",
  "authored" => ["PickAxe II", "The Prag Prog Book"],
  "alias" => "Dave Thomas"}

See, make sure to use amarshal-pretty to get nicely laid out inlines.

Read: Serializing To Ruby Code

Topic: Setting up EliteJournal on TextDrive without a vhost Previous Topic   Next Topic Topic: Seven Christmases

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use