I tried in
Ubuntu 14.04.2 LTS and working fine
Step 1: (the purpose of the first line in designating which interpreter to use for the rest of the file)
#!/usr/bin/env ruby puts "Hello World!"
Step 2: (make the file executable with below command)
chmod u+x hello-world.rb
Please not that If your platform doesn't support the #!/usr/bin/env convention, then don't forget that the script can be run by passing it to the Ruby interpreter manually:
<path_to_ruby_interpreter> -w hello-world.rb