Class: Sprockets::JSRender::Processor

Inherits:
Tilt::Template
  • Object
show all
Includes:
ActionView::Helpers::JavaScriptHelper
Defined in:
lib/sprockets/jsrender/jsrender_processor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



13
14
15
# File 'lib/sprockets/jsrender/jsrender_processor.rb', line 13

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/sprockets/jsrender/jsrender_processor.rb', line 20

def evaluate(scope, locals, &block)
  <<-JSRENDER
(function() {
  $.templates({#{scope.logical_path.gsub(/^jsrender\/(.*)$/i, "\\1").inspect}: "#{escape_javascript data}"});
}).call(this);
  JSRENDER
end

#prepareObject



17
18
# File 'lib/sprockets/jsrender/jsrender_processor.rb', line 17

def prepare
end