Sign & and variable "$1" are crucial - & cause to not wait for execution of ruby script, "$1" is the name (and path) of Your file, so You have to pass them to "default" application. You may also pass them to Your ruby script. Make sure Your bash script is executable - sudo chmod +x bashscript.sh
Right click on Your file, select Open with ... -> Other application
Click on Use a custom command and type a path to bashscript.sh
Tick Set as default to make changes permanent
Now when You double-click on file with the same type Your ruby script should run and file should open in default application.