aemadrid@gmail.com
11/8/2007 7:43:00 PM
This looks really good. Thanks!
AEM
On Nov 8, 1:41 am, Calamitas <calamita...@gmail.com> wrote:
> On 08/11/2007, aemad...@gmail.com <aemad...@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