Module: TypeScript

Defined in:
lib/typescript.rb

Defined Under Namespace

Modules: Source

Constant Summary collapse

EngineError =
ExecJS::RuntimeError
CompilationError =
ExecJS::ProgramError

Class Method Summary collapse

Class Method Details

.compile(script, options = {}) ⇒ Object

Compile a script (String or IO) to JavaScript.



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/typescript.rb', line 51

def compile(script, options = {})
  script = script.read if script.respond_to?(:read)

  if options.key?(:bare)
  elsif options.key?(:no_wrap)
    options[:bare] = options[:no_wrap]
  else
    options[:bare] = false
  end

  Source.context.call("RubyTypeScriptCompiler", '', script, options)
end

.engineObject



40
41
# File 'lib/typescript.rb', line 40

def engine
end

.engine=(engine) ⇒ Object



43
44
# File 'lib/typescript.rb', line 43

def engine=(engine)
end

.versionObject



46
47
48
# File 'lib/typescript.rb', line 46

def version
  Source.version
end