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.



59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/typescript.rb', line 59

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", Source.lib_contents, script, options)
end

.engineObject



48
49
# File 'lib/typescript.rb', line 48

def engine
end

.engine=(engine) ⇒ Object



51
52
# File 'lib/typescript.rb', line 51

def engine=(engine)
end

.versionObject



54
55
56
# File 'lib/typescript.rb', line 54

def version
  Source.version
end