DEV Community


Ruby2JS Has a New Website

jaredcwhite profile image Jared White ・1 min read

Ending the year with a bang! I'm excited to announce that Ruby2JS has a new website!

Ruby2JS is an extensible Ruby to modern JavaScript transpiler you can use in production today. It's for Ruby developers who want to produce JavaScript that looks hand-crafted, rather than machine generated. You can convert Ruby-like syntax and semantics as cleanly and “natively” as possible. This means that (most of the time) you’ll get a line-by-line, 1:1 correlation between your source code and the JS output.

For example:

class MyClass
  def my_method(str)
    ret = "Nice #{str} you got there!"
Enter fullscreen mode Exit fullscreen mode

will get converted to:

class MyClass {
  myMethod(str) {
    let ret = `Nice ${str} you got there!`;
    return ret.toUpperCase()
Enter fullscreen mode Exit fullscreen mode

Ruby2JS can be used to write backend code for execution by Node, or for the frontend in a variety of configurations including Webpack. Check out the installation guide to get set up in no time!

Discussion (2)

Editor guide
techpeace profile image
Matt Buck

Consistently impressed by your work, Jared. This is the first I've heard of Ruby2JS, but I'm excited to try it out.

I have friends that run JavaScript projects that I don't get much of a chance to use because... I just don't want to write more JavaScript than I have to. Going to give this a shot!

jaredcwhite profile image
Jared White Author

Aw thanks Matt! The bulk of the praise by far goes to The Architect (aka Sam Ruby) but I'm grateful to be helping out and shoring up the tooling side a bit so it's easy to plop into pretty much any codebase. Let me know how it goes :)