Ruby in sublime text editor


I am trying to run Ruby code in sublime text editor 3 but it won’t run and is throwing this error. Any idea why?

‘ruby’ is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.1s with exit code 1]

Code I ran:
def foobar
“hello world”

puts foobar


Try adding the Ruby bin folder path to environment variables and execute the file with command ruby filename.rb


thanks. I re-installed ruby and now it works