Class: UnderscoreTemplateRails::UnderscoreTemplate

Inherits:
Tilt::Template
  • Object
show all
Includes:
ActionView::Helpers::JavaScriptHelper
Defined in:
lib/underscore-template-rails/underscore_template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



10
11
12
# File 'lib/underscore-template-rails/underscore_template.rb', line 10

def self.default_mime_type
  'application/javascript'
end

Instance Method Details

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



21
22
23
# File 'lib/underscore-template-rails/underscore_template.rb', line 21

def evaluate(scope, locals, &block)
  %{#{variable}["#{template_name(scope)}"] = _.template("#{escape_javascript(data)}");}
end

#prepareObject



14
15
# File 'lib/underscore-template-rails/underscore_template.rb', line 14

def prepare
end

#variableObject



17
18
19
# File 'lib/underscore-template-rails/underscore_template.rb', line 17

def variable
  Rails.configuration.underscore_templates.variable
end