From: Arul hari Date: 2009-09-02T19:06:24+09:00 Subject: Re: Remove comments from ruby source code? Glenn Jackman wrote: > At 2009-09-01 07:12AM, "Arul hari" wrote: >> Dear Friends, >> If there any pre-defined function or ruby options available >> for removing the ruby comments from the source code. Please any on help >> me if you already aware of this. > > The ruby_parser and ruby2ruby gems will do this: > > require 'ruby_parser' > require 'ruby2ruby' > > code = < # a class > class Simple > # add the method "add" > def add(n1,n2) > n1 + n2 # return the sum > end > end > END > > parsed = Ruby2Ruby.new.process( RubyParser.new.process( code )) > > puts parsed > > results in: > > class Simple > def add(n1, n2) > (n1 + n2) > end > end Dear Friends, Thanks to all for your prompt reply. It was really helpful to me. Regards, S.Vellingiri. -- Posted via http://www.ruby-forum.com/.