Notice the first line, starting with #!. That's the kind of addition which you need to make to your script to make it executable.
#!/usr/bin/env ruby
p "Testing an executable script"
You might also need to change the permissions of the script using chmod. Assuming you name the script below, test.rb; here is what you might need to do :