Meet npm Pro: unlimited public & private packages + package-based permissions.Learn more »

opal-compiler

1.0.15 • Public • Published

Opal Compiler for Node.js

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:

var Builder = require('opal-compiler').Builder;
// Opal object will be available on the global scope
 
var builder = Builder.create();
var 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);

Install

npm i opal-compiler

DownloadsWeekly Downloads

187

Version

1.0.15

License

MIT

Unpacked Size

2.22 MB

Total Files

12

Last publish

Collaborators

  • avatar