<< back to blog

Generate yUML Diagrams in 10 Lines of Ruby

yuml ~ ruby

05 Apr, 2010

First, install gems…

sudo gem install rio curb

Then the script (tweak as needed)….

require 'rubygems'
require 'curb'                                                                               
require 'rio' 

# POST DSL up to yUML
c = Curl::Easy.new("http://yuml.me/diagram/plain/class/")
c.multipart_form_post = true           
c.http_post(Curl::PostField.content("dsl_text","[A]->[B]"))

# Grab the ID, and then download img and save to disk
img_id = c.body_str  
img = "http://yuml.me/#{img_id}"
rio(img) > rio("img.png")   
You may also like...
JSON definition for your yUML Diagrams
Generate yUML Diagrams in 10 Lines of Ruby
yUML Loses Adverts and Gains Forum, Twitter, and New Pricing
Want to be involved with yUML?
Blowing Bubbles With Twitter (And Bursting Them!)
PDF Output With yUML, And Other Things...
yUML Direction Control and Scaling
yUML Diagrams Look Cool On GitHub
yUML Scruffy Hand Drawn Look
A Touch Of Polish for yUML

kick it on DotNetKicks.com
blog comments powered by Disqus