class Closure::Compiler
def compile(io)
JavaScript as a string or yields an IO object containing the response to a
Can compile a JavaScript string or open IO object. Returns the compiled
def compile(io) tempfile = Tempfile.new('closure_compiler') if io.respond_to? :read while buffer = io.read(4096) do tempfile.write(buffer) end else tempfile.write(io.to_s) end tempfile.flush begin result = compile_files(tempfile.path) rescue Exception => e raise e ensure tempfile.close! end yield(StringIO.new(result)) if block_given? result end