Provided with the RubyCocoa binary distribution, starting from 0.11, is the HTML and ri documentation created by BridgeDoc.
What does this mean?
It means that you have access to the latest reference documentation from Apple (07-05-2007) about the Frameworks that RubyCocoa supports, with a twist. The methods and their documentation have been parsed and manipulated to look like the syntax used on the Ruby side of RubyCocoa.Okay, how can I access it?
There are two ways you can get to the documentation, namely:-
HTML
You can find this in /Developer/Documentation/RubyCocoa/Frameworks.
These are regular RDoc generated HTML files. Extra thing to note is that when you click on the method to see the source, you obviously won't be able to get to the source of the method, but there is information in there. The first comment is the name of the method as it was, before it was parsed from the original HTML files. The second line of code is the alternative style of calling methods in RubyCocoa, for your copy-paste pleasure.
-
ri
The ri documentation is automatically recognized by the ri utility. Simply call ri as you normally would from the terminal like so:
$ ri OSX::NSString
Or for a method:
$ ri OSX::NSString.stringWithString
The ri utility is, well, not so fast to say the least. But luckily there is a good alternative, appropriately called fastri.
If you have RubyGems installed, you can simply install it like so:
$ gem install fastri
Fastri consists of 2 parts, a server and a client. First you need to start the server by typing:
$ fastri-server
Once that is done open a new window and use it like ri, but instead use fri.
$ fri OSX::NSString
$ fri OSX::NSString.stringWithString
Now that's fast! But do note that it can be even faster if installed from the tarball instead of through rubygems. Please refer to http://eigenclass.org/hiki/fastri#l1∞ about how to do this.
Final note
There can still be bugs in the parsing of the original documentation which can lead to weird characters showing up. Like HTML entities etc. If you spot any of them or any other error please do drop us a message. See GettingSupport for details.TODO
- Add documentation for the new functionality that adds setters in a more rubyesque way, for instance:
def setFoo(arg)
...
end
# The bridge will add a setter method like this:
def foo=(arg)
...
end
...
end
# The bridge will add a setter method like this:
def foo=(arg)
...
end