From: Brian Candler Date: 2010-09-22T04:25:26+09:00 Subject: Re: Ruby-based data language Thomas Sawyer wrote: > name "Joe Foo" > age 33 > contact do > email "joe@joefoo.com" > phione "555-555-1234" > end You could make a parser for that fairly easily - or transform it to JSON or YAML and parse that (assuming that contact do .. end constructs a nested Hash) > Such a format would be to Ruby as JSON is to Javascript. And Ruby has a nice advantage with blocks. That's where I disagree with you. You are using blocks in a Builder or Markaby way, but that's not the fundamental purpose or interpretation of blocks in the language. And how would you handle Arrays? The Ruby equivalent of JSON would be a literal Hash: { "name"=>"Joe Foo", "age"=>33, "contact"=>{ "email"=>"joe@joefoo.com", "phone"=>"555-555-1234", }, } Or if you buy into 1.9 syntax, then you could have { name: "Joe Foo", age: 33, contact: { email: "joe@joefoo.com", phone: "555-555-1234", }, } Both are similar enough to JSON that I'd use that instead, and gain the portability benefit. It's a shame that JSON doesn't allow trailing commas. -- Posted via http://www.ruby-forum.com/.