Checking Syntax in Ruby

To check if a given Ruby file has any syntax errors:

ruby -cw file.rb

Using the flags:

  • c to check
  • w for extra warnings