Class: TypeScript::Rails::Template

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/typescript/rails/template.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_bareObject



8
# File 'lib/typescript/rails/template.rb', line 8

class_attribute :default_bare

.engine_initialized?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/typescript/rails/template.rb', line 10

def self.engine_initialized?
  defined? ::TypeScript::Rails::Compiler
end

Instance Method Details

#allows_script?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/typescript/rails/template.rb', line 29

def allows_script?
  false
end

#evaluate(context, locals, &block) ⇒ Object



24
25
26
# File 'lib/typescript/rails/template.rb', line 24

def evaluate(context, locals, &block)
  @output ||= ::TypeScript::Rails::Compiler.compile(file, data, context)
end

#initialize_engineObject



14
15
16
# File 'lib/typescript/rails/template.rb', line 14

def initialize_engine
  require_template_library 'typescript/rails/compiler'
end

#prepareObject



18
19
20
21
22
# File 'lib/typescript/rails/template.rb', line 18

def prepare
  if !options.key?(:bare) and !options.key?(:no_wrap)
    options[:bare] = self.class.default_bare
  end
end