Bash and Zsh's HEREDOC seems to act like a file, instead of string, and if I hope to do something like
foo() {
    ruby << 'EOF'
        3.times do
            puts "Ruby is getting the argument #{ARGV[0]}"
        end
EOF 
}
is there a way to pass in an argument to the Ruby program?  It will be best not to interpolate the $1 into the Ruby code, so that's why I am using 'EOF' instead of EOF, as interpolating into the Ruby code can be messy.
There is one way to use the HEREDOC as a string, by the following method:
foo() {
    ruby -e "$(cat << 'EOF'
        3.times do
            puts "Ruby is getting the argument #{ARGV[0]}"
        end
EOF
)" $1    
}
and it works (although a little bit hacky). But is there a way then to use the HEREDOC's usual way of treating it as a file and be able to supply an argument to Ruby?

.bashrcand.zshrc? We could have a bunch of scripts in the~/binfolder but if we have a few short commands inside of.bashrc, that's easier to manage