Skip to content

Instantly share code, notes, and snippets.

@maxim
Created December 3, 2008 13:42
Show Gist options
  • Save maxim/31538 to your computer and use it in GitHub Desktop.
Save maxim/31538 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'sinatra'
require 'tempfile'
class Jaxer
class << self
def json_to_png(json)
# producing tempfile
file = Tempfile.new('jaxer')
file.open do |f|
yield(f)
end
end
end
end
get '/' do
Jaxer.json_to_png(params[:data]) do |img|
@str = 'hello'
end
@str
end
not_found do
'resource missing'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment