lib/sproutcore-rails/hjs_template.rb
# Generates Javascript code from a HandlebarsJS template.
# The SC template name is derived from the lowercase logical asset path
# by replacing non-alphanum characheters by underscores.
Generates Javascript code from a HandlebarsJS template.
The SC template name is derived from the lowercase logical asset path
by replacing non-alphanum characheters by underscores.
Generates Javascript code from a HandlebarsJS template . The SC template name is derived from the lowercase logical asset path by replacing non - alphanum characheters by underscores .
def evaluate(scope, locals, &block)
      template = data.dup
      template.gsub!(/"/, '\\"')
      template.gsub!(/\r?\n/, '\\n')
      template.gsub!(/\t/, '\\t')
      "SC.TEMPLATES[\"#{scope.logical_path.downcase.gsub(/[^a-z0-9]/, '_')}\"] = SC.Handlebars.compile(\"#{template}\");\n"
    end
def evaluate ( scope , locals , & block ) template = data . dup template . gsub! ( / " / , '\\"' ) template . gsub! ( / \r ? \n / , '\\n' ) template . gsub! ( / \t / , '\\t' ) "SC.TEMPLATES[\"#{scope.logical_path.downcase.gsub(/[^a-z0-9]/, '_')}\"] = SC.Handlebars.compile(\"#{template}\");\n" end
Generates Javascript code from a HandlebarsJS template.
Generates Javascript code from a HandlebarsJS template .
scope
locals
block