Module: Babel::Transpiler
- Defined in:
- lib/babel/transpiler.rb,
lib/babel/transpiler/version.rb
Constant Summary collapse
- VERSION =
"0.7.0"
Class Method Summary collapse
- .context ⇒ Object
- .script_path ⇒ Object
- .source_path ⇒ Object
- .source_version ⇒ Object
- .transform(code, options = {}) ⇒ Object
- .version ⇒ Object
Class Method Details
.context ⇒ Object
23 24 25 |
# File 'lib/babel/transpiler.rb', line 23 def self.context @context ||= ExecJS.compile("var self = this; " + File.read(script_path)) end |
.script_path ⇒ Object
19 20 21 |
# File 'lib/babel/transpiler.rb', line 19 def self.script_path File.join(source_path, "babel.js") end |
.source_path ⇒ Object
15 16 17 |
# File 'lib/babel/transpiler.rb', line 15 def self.source_path Source::PATH end |
.source_version ⇒ Object
11 12 13 |
# File 'lib/babel/transpiler.rb', line 11 def self.source_version Source::VERSION end |
.transform(code, options = {}) ⇒ Object
27 28 29 |
# File 'lib/babel/transpiler.rb', line 27 def self.transform(code, = {}) context.call('babel.transform', code, .merge('ast' => false)) end |
.version ⇒ Object
7 8 9 |
# File 'lib/babel/transpiler.rb', line 7 def self.version VERSION end |