Xcode for Ruby, pt 2

A second issue with using Xcode for editing Ruby is that it by default does not correctly comment code in Ruby files. This again is easy to fix:
Open the scripts menu, choose Edit User Scripts.
Select Comments: Un/Comment Selection
This will bring up a Perl script that Xcode uses to perform the comment/uncomment function. We need to modify this to recognize Ruby file types:

Replace:

# determine the type of file we have by looking for the #! line at the top
# careful--it might already be commented out!
my $commentString;
if ($fileString =~ m!^($perlCmt|$cCmt)?#\!\s*.*?/perl|^($perlCmt|$cCmt)?#\!\s*.*?#\!\s*.*?/sh!) {
    $commentString = $perlCmt;
} else {
    $commentString = $cCmt;
}

with:

my $fileName = "%%%{PBXFilePath}%%%";
# determine the type of file we have by looking for the #! line at the top
# careful--it might already be commented out!
# Otherwise look at the file extension
my $commentString;
if ($fileString =~ m!^($perlCmt|$cCmt)?#\!\s*.*?/perl|^($perlCmt|$cCmt)?#\!\s*.*?/ruby|^($perlCmt|$cCmt)?#\!\s*.*?/sh!
        || $fileName =~ m!\.(rb|erb|rake|pl|sh)$!) {
    $commentString = $perlCmt;
} else {
    $commentString = $cCmt;
}