Ruby and Quicksilver: Executing Ruby one-liners with Quicksilver

To plug Ruby directly into your brain, take three short breaths, mutter a prayer to Matz, and then follow these instructions:

Prerequisites: Mac OS X Panther or greater and Quicksilver

  1. Download this humble Applescript
    using terms from application "Quicksilver"
        on process text t
            do shell script "ruby -00 -e '" & t & "'"
        end process text
    end using terms from
  2. Unzip the script and copy it to ~/Library/Application Support/Quicksilver/Actions/
  3. Restart Quicksilver

Once you’ve plugged in, Ruby is just a blink away:

  1. Invoke Quicksilver (CTRL-Space)
  2. Type a period (.) followed by your one-line stroke of genius, such as:
    [ "in", "me", "plug" ].reverse_each {|x| print x.upcase, " " }
  3. Press TAB
  4. Type until ruby is displayed in the second pane
  5. Press Return

The results of your Ruby one-liner (‘PLUG ME IN’ in this case) are placed back into the first pane of Quicksilver for your digestion.

_Thanks to bsg for the inspiration. _

Comments

Leave a response

  1. Chris had this to say Thu, 12 Jan 2006 01:17:48 GMT

    Gee thanks. Now that’s its plugged into my brain, I get it!

Your Comments