The Ruby programming language runtime has been ported to Google’s Native Client (NaCl) framework. The port, which was implemented by Google, will make it possible for NaCl-enabled Web browsers to execute client-side Ruby code.

Google engineer Yuki Sonoda merged the patch into MRI, the standard C-based Ruby reference implementation. It’s now possible to generate an NaCl-compatible build of Ruby by using a compile-time option. The resulting ruby.nexe can be loaded by the NaCl browser plugin and used in Web applications.

Native Client is a mechanism for running arbitrary native code within a Web browser. A custom development toolchain supplied by Google can be used to compile conventional C/C++ code into OS-neutral binary executables that can be run by the browser plugin. NaCl uses a sophisticated sandboxing mechanism to avoid the security pitfalls that afflicted similar legacy technologies, such as ActiveX.

The complete patch for NaCl-enabling Ruby can be viewed online at GitHub. What’s particularly striking about it is that the diff is relatively thin and the code changes are less intrusive than you might expect. It’s a good illustration of how easily NaCl can be used to bring complex C code base to the Web.

Along similar lines, we recently noticed a separate project called Emscripted Ruby that is using Emscripten to port MRI to conventional JavaScript. Unlike the NaCl port, Emscripted Ruby can run in any browser and doesn’t require a plugin. The downside is that it’s built on Ruby 1.8.7 instead of 1.9 like the NaCl port.

Bullets

The possibility of using client-side Ruby in Web applications caught our eye this week, but there were a few other recent developments that will round out our HTML5 roundup.