Using the Ruby Librarian - a step-by-step guide
The Ruby Librarian (our new ’extended’ IntelliSense tool - see previous blog post for more information) is a project that’s been hovering in the background for some time now. However, it’s taken some effort to get it to the stage where we think it’s ready to use. Part of the problem has been the peculiar nature of Ruby IntelliSense (particularly as applied to Rails) and some of the problem has been how to integrate it into Visual Studio. Here’s a tutorial on how to use it.
| Note: The Ruby Librarian forms part of Ruby In Steel 1.3 which is currently in beta and will be released in a few weeks.
Registered users will have access to the first beta in a day or two and this will be announced in the forum.
In Ruby In Steel 1.3, when you click on the Ruby menu you’ll see a new Librarian icon
Clicking the Librarian menu item will display the main Librarian screen:
Click the Add Files button to display a file browser and use this to select the Ruby files that you wish to use in the library. Here I’ve selected the standard complex.rb and date.rb.
Once you decided on the files, you’ll see them displayed in the Available Files list box.
Now you can select which files to use or (more commonly) select all of the files by clicking on the double right arrow icon.
Next, Click the Generate icon to create the library file itself...
...and enter the name of the library file (here test.rbp. Once the Library generation is complete - it doesn’t take long - a new library file will have been created.
Now, you need to add it to the project.
Right click the References node in the Solution Explorer and select Add Reference. You’ll see the standard Visual Studio Add Reference dialog box appear. Select the Browse tab from the available libraries choose test.rbp. Click Add then OK.
You should now see a new node under References in the Solution Explorer:
Now you can use types from the Complex class without any ’requiring’:
In a similar way you can add any other ’custom’ libraries to give you access to IntelliSense in code files which (as so often in Rails) do not have requires to load the classes you need.