ggrossetie / opal-node-compiler

Opal Compiler for Node.js

Home Page:https://opalrb.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Opal Compiler for Node.js

Build npm version

Transpile Ruby code to JavaScript in JavaScript!

Usage

Given a Ruby file named hello.rb:

puts "Hello world"

The following code will transpile hello.rb to JavaScript:

const Builder = require('opal-compiler').Builder
// Opal object will be available on the global scope

const builder = Builder.create()
const result = builder.build('hello.rb').toString()
console.log(result)
//(function(Opal) {
//  var self = Opal.top, $scope = Opal, nil = Opal.nil, $breaker = Opal.breaker, $slice = Opal.slice;

//  Opal.add_stubs(['$puts']);
//  return self.$puts("Hello world")
//})(Opal);

About

Opal Compiler for Node.js

https://opalrb.com/

License:MIT License


Languages

Language:JavaScript 98.7%Language:Ruby 1.3%