Class: Opal::TiltTemplate

Inherits:
Tilt::Template
  • Object
show all
Defined in:
opal/lib/tilt/opal.rb

Direct Known Subclasses

Processor

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compiler_optionsObject


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

.versionObject


20
21
22
# File 'opal/lib/tilt/opal.rb', line 20

def self.version
  ::Opal::VERSION
end

Instance Method Details

#compiler_optionsObject


47
48
49
# File 'opal/lib/tilt/opal.rb', line 47

def compiler_options
  self.class.compiler_options
end

#evaluate(_, _, &block) ⇒ Object


35
36
37
38
39
40
41
42
43
44
45
# File 'opal/lib/tilt/opal.rb', line 35

def evaluate(_, _, &block)
  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_engineObject


28
29
30
# File 'opal/lib/tilt/opal.rb', line 28

def initialize_engine
  require_template_library 'opal'
end

#prepareObject


32
33
# File 'opal/lib/tilt/opal.rb', line 32

def prepare
end