Adding Ruby to Run Shell Script

If you want to interact with Ruby from within Automator you can do the following:

Add this XML:

<key>/usr/bin/ruby</key>
<dict>
    <key>args</key>
    <array>
        <string>-e</string>
        <string>%</string>
        <string>--</string>
    </array>
    <key>script</key>
    <array>
        <string>$stdin.each { |arg| puts arg }</string>
        <string>ARGV.each { |arg| puts arg }</string>
    </array>
</dict>

to the file:

/System/Library/Automator/Run Shell Script.action/Contents/Resources/Shells.plist

Now when Automator is restarted /usr/bin/ruby will show up in the Shells: list of action Run Shell Script.

I got the idea from this Apple Discussion post telling how to add PHP.