Class: Sprockets::JstProcessor
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Sprockets::JstProcessor
- Defined in:
- lib/sprockets/jst_processor.rb
Instance Attribute Summary collapse
-
#namespace ⇒ Object
readonly
Returns the value of attribute namespace.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#namespace ⇒ Object (readonly)
Returns the value of attribute namespace.
17 18 19 |
# File 'lib/sprockets/jst_processor.rb', line 17 def namespace @namespace end |
Class Method Details
.default_mime_type ⇒ Object
5 6 7 |
# File 'lib/sprockets/jst_processor.rb', line 5 def self.default_mime_type 'application/javascript' end |
.default_namespace ⇒ Object
9 10 11 |
# File 'lib/sprockets/jst_processor.rb', line 9 def self.default_namespace 'this.JST' end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/sprockets/jst_processor.rb', line 19 def evaluate(scope, locals, &block) "(function() {\n \#{namespace} || (\#{namespace} = {});\n \#{namespace}[\#{scope.logical_path.inspect}] = \#{indent(data)};\n}).call(this);\n JST\nend\n" |
#prepare ⇒ Object
13 14 15 |
# File 'lib/sprockets/jst_processor.rb', line 13 def prepare @namespace = self.class.default_namespace end |