Structured data exchange: Ruby <=> Javascript
-
In Sketchup we have Ruby within it we have WebDialogs through which we have Javascript (through the Safari or IE Javascript VMs). I've always heard that if you need to exchange structured information like arrays, hashes, objects between Ruby and Javascript you should be emitting JSON strings back and forth. I run across this post by "why" entitled "YAML is JSON" and it got me thinking that maybe its YAML we should be working on.
There is a pure Javascript YAML emitter class ( probably you don't need a parser,... JSON is a proper Javascript subset and JSON.almost_equal?(YAML) == true
and a pure Ruby YAML class (emitter&parser) too!I haven't done any testing so someone with some more time,... please do the honours

I am pretty sure this isn't as easy I present it to be and I assume a 30% possibility of it working with minimal effort, although I think that we need to come up with a ruby library for Sketchup and deal with it once and for all.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement