Compile a script (String or IO) to JavaScript.
# File lib/coffee_script.rb, line 48 def compile(script, options = {}) script = script.read if script.respond_to?(:read) if options.key?(:bare) elsif options.key?(:no_wrap) options[:bare] = options[:no_wrap] else options[:bare] = false end wrapper = (function(script, options) { try { return CoffeeScript.compile(script, options); } catch (err) { if (err instanceof SyntaxError && err.location) { throw new SyntaxError([ err.filename || "[stdin]", err.location.first_line + 1, err.location.first_column + 1 ].join(":") + ": " + err.message) } else { throw err; } } }) Source.context.call(wrapper, script, options) end
Generated with the Darkfish Rdoc Generator 2.