mruby是一款轻量级的Ruby实现,遵循ISO标准。它可以以解释的形式或者在VM上编译和执行形式运行。
示例代码:
class NSString < Mobi::Cocoa::Object end
class UIAlertView < Mobi::Cocoa::Object end
def _S(str) NSString._stringWithUTF8String str end
alert = UIAlertView._alloc \ ._initWithTitle _S(“Hello”), :message, _S(“I’m MobiRuby”), :delegate, nil, :cancelButtonTitle, _S(“I know!”), :otherButtonTitles, nil alert._show