Module: ES6ModuleTranspiler
- Defined in:
- lib/ruby_es6_module_transpiler.rb
Constant Summary collapse
- Node =
::ExecJS::ExternalRuntime.new( name: 'Node.js (V8)', command: ['nodejs', 'node'], runner_path: File.('../support/es6-node-runner.js', __FILE__), encoding: 'UTF-8' )
Class Attribute Summary collapse
-
.js_code ⇒ Object
Returns the value of attribute js_code.
Class Method Summary collapse
- .test ⇒ Object
-
.transpile(code, options = {}) ⇒ Object
accepts amd, cjs, yui, or global.
Class Attribute Details
.js_code ⇒ Object
Returns the value of attribute js_code.
5 6 7 |
# File 'lib/ruby_es6_module_transpiler.rb', line 5 def js_code @js_code end |
Class Method Details
.test ⇒ Object
14 15 16 17 18 |
# File 'lib/ruby_es6_module_transpiler.rb', line 14 def test a = "import { get, set } from 'ember';" re = transpile(a) re end |
.transpile(code, options = {}) ⇒ Object
accepts amd, cjs, yui, or global. defaults to amd.
21 22 23 24 |
# File 'lib/ruby_es6_module_transpiler.rb', line 21 def transpile(code, = {}) @js_code = code Node.exec(generate_source()) end |