Question: I use following now to check syntax error:

```
system "ruby -wc path/to/file.rb"

```

but it very waste time if there are too many file(for instance, i refactory code), so **my question is:** is there way to ruby syntax check in ruby code?

Answer: 
The simplest way is with the command line `-c` flag:

```
ruby -c file_you_want_to_check.rb

```
You can use Ripper, the Ruby interface to the Ruby parser:

<http://ruby-doc.org/stdlib/libdoc/ripper/rdoc/Ripper.html>