Developing apps for Mobile Device in Ruby

May 2, 2012


This project has not seen any activity since 2013 and the original domain name is not even retained anymore.

RubyMotion had better success for a while but since React Native came out and gained traction, the most frequent contributors to RubyMotion seems to have switched to that framework.

Original Post

There has been a lot of buzz within the community lately about upcoming releases of Ruby implementations to mobile devices and I am no less excited than anybody else. Anything that would get me away from that freakin' Objective-C is welcome.

The first step towards this is the mruby project which I will quote here:

"mruby is the lightweight implementation of the Ruby language complying to the ISO standard. mruby can run Ruby code in 'interpreter mode' or 'compile and execute it on a virtual machine' depending on the developer's preference."

So far though, the mruby is only in its prerelease state but the source code is public for anyone that wants to look closer or submit thoughts and ideas.

The next step will be the MobiRuby project which takes advantage of mruby. They state that the goal of this project is to replace Objective-C, C and Java on the mobile platforms. The first target is the iOS platform and Andriod will be the next runner up.

The release date for MobiRuby will be sometime late spring or summer 2012 and I for one can't wait to play around with it.

So just to give you some example of what this will be like, here is a comparison of syntax for the basic function of creating an alert.

In Objective-C:

UIAlertView *alert = [[UIAlertView alloc]
            initWithTitle: @"Hello"
            message: @"I'm Objective-C"
            delegate: nil
            cancelButtonTitle:@"Not again..."
[alert show];

And in MobiRuby:

alert = UIAlertView._alloc \
  ._initWithTitle _S("Hello"),
  :message, _S("I'm MobiRuby"),
  :delegate, nil,
  :cancelButtonTitle, _S("Finally!"),
  :otherButtonTitles, nil

I know it's not really less code for this example but just looking at the ruby syntax is sooo much nicer in my opinion.

And finally, I just want to reference a talk that Matz himself did just recently. Here it is.

Part 1

Part 2