Class: Opal::TiltTemplate
- Inherits:
-
Tilt::Template
- Object
- Tilt::Template
- Opal::TiltTemplate
- Defined in:
- opal/lib/tilt/opal.rb
Class Method Summary collapse
- .compiler_options ⇒ Object
- .engine_initialized? ⇒ Boolean
- .inherited(subclass) ⇒ Object
- .version ⇒ Object
Instance Method Summary collapse
- #compiler_options ⇒ Object
- #evaluate(_scope, _locals) ⇒ Object
- #initialize_engine ⇒ Object
- #prepare ⇒ Object
Class Method Details
.compiler_options ⇒ Object
24 25 26
# File 'opal/lib/tilt/opal.rb', line 24 def self.compiler_options Opal ::Config .compiler_options .merge(requirable: true) end
.engine_initialized? ⇒ Boolean
Returns:
- (Boolean)
16 17 18
# File 'opal/lib/tilt/opal.rb', line 16 def self.engine_initialized? true end
.inherited(subclass) ⇒ Object
12 13 14
# File 'opal/lib/tilt/opal.rb', line 12 def self.inherited(subclass) subclass.default_mime_type = 'application/javascript' end
Instance Method Details
#compiler_options ⇒ Object
48 49 50
# File 'opal/lib/tilt/opal.rb', line 48 def compiler_options self.class.compiler_options end
#evaluate(_scope, _locals) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46
# File 'opal/lib/tilt/opal.rb', line 36 def evaluate(_scope, _locals) if builder = @options[:builder] builder.dup.build(file).to_s elsif @options[:build] Opal ::Builder .build (file).to_s else compiler_options = (compiler_options || {}).merge!(file: file) compiler = Compiler .new (data, compiler_options) compiler.compile.to_s end end
#initialize_engine ⇒ Object
28 29 30
# File 'opal/lib/tilt/opal.rb', line 28 def initialize_engine require_template_library 'opal' end
#prepare ⇒ Object
32 33 34
# File 'opal/lib/tilt/opal.rb', line 32 def prepare # stub end