Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Ruby Slims Down for Mobile with MRuby, RubyMotion, Ruboto

Ruby Slims Down for Mobile with MRuby, RubyMotion, Ruboto

Leia em Português

This item in japanese

In the past weeks, a number of new Ruby implementations and dialects have joined the already substantial zoo of different Rubies, they're called MRuby, MobiRuby, and RubyMotion. In the following we are going to shed some light on the possibilities they offer.

We start with MRuby, developed by Ruby's creator Matz. At RubyConf 2010, Matz announced that he's working on Rite, a new light-weight Ruby implementation. The result of that work is MRuby, which has now been released to GitHub. MRuby is fully compliant with the Ruby language specification that has recently been specified by ISO, but it has a completely different focus than MRI and Ruby 1.9, so MRuby is not Ruby 2.0. MRuby can be used to simply run Ruby programs, but it's been designed specifically to be integrated into other programs (e.g. in games as an alternative to the Lua scripting language) and to run on small devices with reduced memory. MRuby also comes with a heavily reduced standard library and misses some features; Matz mentioned in the keynote that threads and multilingualization (m17n) are not supported. Others can be customized at compile time (e.g. to remove file I/O, or to choose a character encoding).

Matt Aimonetti wrote a guide on how to get started with MRuby, and he also has a detailed comparison of MRuby to Lua. Projects that build on MRuby have already started to appear, which brings us to MobiRuby.

MobiRuby "aims to replace Objective-C/C/Java on mobile platforms with Ruby, just like you can use Lua or Mono to build apps on those platforms". And again, Matt Aimonetti has a good analysis of the challenges the project faces, like the performance hit of having two runtimes, and the interaction with the platform's native APIs and documentation. Unfortunately, the MobiRuby code hasn't been released yet, so it's hard to make an educated judgment.

But if you still want to develop for iOS in Ruby right now, there are other options. Laurent Sansonetti, the creator of MayRuby, just launched RubyMotion, a proprietary fork of MacRuby that also enables you to write your iOS apps in Ruby (read more about it on InfoQ). Rake is used to create, run and compile your application, and the whole workflow is command line based, but it's nevertheless possible to use Apple's Interface Builder and Storyboard. RubyMotion is more a dialect of Ruby than another full-blown implementation, so you cannot easily reuse existing Ruby gems. 

Android developers don't have to despair, Ruboto has made steady progress in the past months. And there's also Mirah, which has at least a very Ruby-like syntax and also comes with Android support in the form of Pindah. On a final note, Rhomobile, the creator of the Ruby-based cross-platform framework Rhodes, has recently been acquired by Motorola Solutions (that's not the part of Motorola that Google plans to acquire).

How are you going to develop your next iOS app?

Rate this Article