« Previous day (Feb 19, 2007) | Main | Next day (Feb 21, 2007) »

20070220 Tuesday February 20, 2007

Ruby Screenshot of the Week #4

If you try code completion on any complicated arbitrary expression, it will show you a number of possible method completions along with the corresponding class. This gives you much the same information as ri:

However, in many contexts, we know the exact type. For example, if you type File. and invoke code completion, NetBeans will show you only the singleton methods of class File (as well as inherited methods and module mixins):

In some cases, we know more than just the class - we know that we're dealing with an instance of that object. In that case we can show all the instance methods too - not just the class methods:

Here's we're applying code completion on a regular expression literal.

This works for all kinds of literals in your code - Strings, regular expressions (shown above), arrays (try [1,2,3].e to see the each method and its documentation for example), hashes, symbols, numbers, ... you can even try it on the "nil" keyword!

(2007-02-20 17:34:23.0) Permalink Comments [10]