Class: Tilt::TypeScriptTemplate

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

Instance Attribute Summary

Attributes inherited from Template

#data, #file, #line, #options

Instance Method Summary collapse

Methods inherited from Template

#basename, default_mime_type, default_mime_type=, #eval_file, #initialize, metadata, #metadata, #name, #render

Constructor Details

This class inherits a constructor from Tilt::Template

Instance Method Details

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



22
23
24
# File 'lib/tilt/typescript.rb', line 22

def evaluate(scope, locals, &block)
  @output ||= TypeScript::Node.compile(data, *@option_args)
end

#prepareObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tilt/typescript.rb', line 8

def prepare
  @option_args = []

  options.each do |key, value|
    next unless value

    @option_args << "--#{key}"

    if value != true
      @option_args << value.to_s
    end
  end
end