I blogged here about tweaking TextMate bundle for Groovy so the output appears in a tooltip.
You can do the same thing for Ruby as well. I am teaching a Ruby on Rails course this week and to my pleasant surprise some of the attendees are on Mac. So, we're sharing some Mac tricks as well. One of first things they wanted to know was how I display the output in in TextMate.
I hate for a separate window to popup for output. The tooltip style is convenient to quickly show output right after you type code. It is real simple to set this up.
In TextMate, go to Bundles | Bundle Editor | Show Bundle Editor. Go to Ruby -> Run to Edit command for Run. Modify as shown below:
Here's the code I have in Commands:
if [ -e "${TM_FILEPATH}" ]; then
"ruby" "${TM_FILEPATH}"
else
puts "File not found or not saved. Please save first or try 'Run script' on a selection of text"
fi
Now, write Ruby code in a .rb file and simply press Command + R to see the output in a tooltip, as shown below:
While some of the attendees are using Mac, the rest of the attendees are using Windows. They wanted TextMate on Windows! So, I asked them to give E Text Edit a try, and they seem to like it so far.