From: Calamitas Date: 2007-11-08T17:41:40+09:00 Subject: Re: Dynamic syntax check On 08/11/2007, aemadrid@gmail.com wrote: > Is there any way to check the Ruby syntax on a file or string of Ruby > code besides doing something like `ruby -v xyz.rb`? Is there a gem > that would help me here? From the file sample/test.rb in the Ruby source code distribution: def valid_syntax?(code, fname) eval("BEGIN {return true}\n#{code}", nil, fname, 0) rescue Exception puts $!.message false end Peter