Class: Dart::Dart2JsCompiler
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Dart::Dart2JsCompiler
- Defined in:
- lib/dart/sprockets/dart2js_compiler.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call(input) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/dart/sprockets/dart2js_compiler.rb', line 21 def self.call(input) # it's necessary for dart2js to have the dart file in th same directory as its depencencies compiler = ::Dart2Js.new(input[:data], pwd: File.dirname(input[:filename])) result = compiler.compile compiler.close result end |
.engine_initialized? ⇒ Boolean
8 9 10 |
# File 'lib/dart/sprockets/dart2js_compiler.rb', line 8 def self.engine_initialized? defined? ::Dart2Js end |
Instance Method Details
#evaluate(context, locals, &block) ⇒ Object
29 30 31 |
# File 'lib/dart/sprockets/dart2js_compiler.rb', line 29 def evaluate(context, locals, &block) self.class.call({ filename: context.pathname, data: data }) end |
#initialize_engine ⇒ Object
12 13 14 15 16 |
# File 'lib/dart/sprockets/dart2js_compiler.rb', line 12 def initialize_engine unless defined? ::Dart2Js require_template_library 'dart2js' end end |
#prepare ⇒ Object
18 19 |
# File 'lib/dart/sprockets/dart2js_compiler.rb', line 18 def prepare end |