From: Arul hari Date: 2010-03-02T20:48:38+09:00 Subject: Re: Remove comments from ruby source code? Arul hari wrote: > 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. Dear Friends, I am facing problem after removing comments. #! => should not remove from the source code , but I am using ruby2ruby module to remove the comments. Is there any way to not remove the #! line. Please anyone help me to go ahed on this. Kindly let me know it. Regards, S.vellingiri. -- Posted via http://www.ruby-forum.com/.