From: Jonathan P. <jp...@dc...> - 2005-06-06 07:48:34
|
On 5 Jun 2005, at 23:31, Dave Howell wrote: > Of course. I don't expect to have Cocoa documented in Ruby per se. > What I'm missing are critical details about the interface. > > For example, where on earth is the application itself? The Obj-C- > based documentation states that the variable "NSApp" contains the > application object. When I use AppleScript, the application is the > default environment until/unless I use a > tell app "Somebody Else" > blah blah blah > end tell > block to change my context. > > I haven't found any hints so far for getting my hands on the > application itself in Ruby. I don't think a Cocoa manual's going to > be much help there. > RubyCocoa is a lot closer to the Objective C interface than the AppleScript one. Look at the documentation for [NSApplication sharedApplication] - this is the method you use to get a reference to the single NSApplication object. This happens to be stored in the global variable NSApp too for convenience, but I don't think it's accessible from Ruby. So, you'd do: app = OSX::NSApplication.sharedApplication Having said this, I think it's rare that you actually need a reference to the application itself - what do you need it for? |