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.
15 16 17 |
# File 'lib/sprockets/jst_processor.rb', line 15 def namespace @namespace end |
Class Method Details
.default_namespace ⇒ Object
7 8 9 |
# File 'lib/sprockets/jst_processor.rb', line 7 def self.default_namespace 'this.JST' end |
Instance Method Details
#evaluate(scope, locals, &block) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/sprockets/jst_processor.rb', line 17 def evaluate(scope, locals, &block) "(function() { \#{namespace} || (\#{namespace} = {}); \#{namespace}[\#{scope.logical_path.inspect}] = \#{indent(data)};\n}).call(this);\n JST\nend\n" |
#prepare ⇒ Object
11 12 13 |
# File 'lib/sprockets/jst_processor.rb', line 11 def prepare @namespace = self.class.default_namespace end |