lib/ejs.rb
# Compiles an EJS template to a JavaScript function. The compiled
# function takes an optional argument, an object specifying local
# variables in the template.  You can optionally pass the
# `:evaluation_pattern` and `:interpolation_pattern` options to
# `compile` if you want to specify a different tag syntax for the
# template.
#
#     EJS.compile("Hello <%= name %>")
#     # => "function(__scope){...}"
#
Compiles an EJS template to a JavaScript function. The compiled
function takes an optional argument, an object specifying local
variables in the template.


Compiles an EJS template to a JavaScript function . The compiled function takes an optional argument an object specifying local variables in the template .
def compile(source, options = {})
      source = source.dup
      js_escape!(source)
      replace_escape_tags!(source, options)
      replace_interpolation_tags!(source, options)
      replace_evaluation_tags!(source, options)
      source = "function(__scope){if(!__scope){__scope = {};};var __p=[],print=function(){__p.push.apply(__p,arguments);};" +
        "__p.push('#{source}'); return __p.join('');}"
      inject_scope(source)
    end
def compile ( source , options = { } ) source = source . dup js_escape! ( source ) replace_escape_tags! ( source , options ) replace_interpolation_tags! ( source , options ) replace_evaluation_tags! ( source , options ) source = "function(__scope){if(!__scope){__scope = {};};var __p=[],print=function(){__p.push.apply(__p,arguments);};" + "__p.push('#{source}'); return __p.join('');}" inject_scope ( source ) end
Compiles an EJS template to a JavaScript function.
Compiles an EJS template to a JavaScript function .
source
<not_specific>
options
<not_specific>