Skip to content

Differences between MacRuby and RubyCocoa

isaac edited this page Apr 12, 2012 · 1 revision

MacRuby supports a new parameter syntax: menu.addItemWithTitle(“Speak”, action: “speak:”, keyEquivalent: ’’)

In this example using speak or speak_ as the selector name doesn’t work, only speak: works.

The prefixes OSX:: and include OSX are unnecessary, because everything is defined on the main object.

There is no need to explicitly subclass NSObject, because all classes inherit from it by default.

Use framework “Cocoa”, instead of require “osx/cocoa”.

ib_outlet and ib_action are deprecated. To set outlets, use standard attr_writer or attr_accessor calls. To define actions, simply define methods that accept one argument named sender.

There’s no objc_methods method. However, calling methods passing the second parameter as true will return the list of Objective-C methods that the receiver responds to.

Something went wrong with that request. Please try again.