Class: Ember::ES6Template::ES6
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Ember::ES6Template::ES6
- Defined in:
- lib/ember/es6_template/sprockets/es6.rb,
lib/ember/es6_template/sprockets-legacy/es6.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(input) ⇒ Object
8 9 10 |
# File 'lib/ember/es6_template/sprockets/es6.rb', line 8 def self.call(input) instance.call(input) end |
.default_mime_type ⇒ Object
4 5 6 |
# File 'lib/ember/es6_template/sprockets-legacy/es6.rb', line 4 def self.default_mime_type 'application/javascript' end |
.instance ⇒ Object
4 5 6 |
# File 'lib/ember/es6_template/sprockets/es6.rb', line 4 def self.instance @instance ||= new end |
Instance Method Details
#call(input) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ember/es6_template/sprockets/es6.rb', line 12 def call(input) data = input[:data] dependencies = [ input[:load_path], input[:filename], data ] result = input[:cache].fetch(_cache_key + dependencies) do transform(data, input) end result['code'] end |
#evaluate(scope, locals, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ember/es6_template/sprockets-legacy/es6.rb', line 10 def evaluate(scope, locals, &block) env = scope.environment return data if module?(scope.pathname.to_s) result = Babel::Transpiler.transform(data, 'modules' => 'commonStrict', 'sourceRoot' => env.root, 'moduleRoot' => '', 'filename' => scope.logical_path ) result['code'] end |
#prepare ⇒ Object
8 |
# File 'lib/ember/es6_template/sprockets-legacy/es6.rb', line 8 def prepare; end |