From: Robert Klemme Date: 2009-09-25T15:05:05+09:00 Subject: Re: Get functions names with regex On 09/25/2009 06:15 AM, Josh Cheek wrote: > > On Thu, Sep 24, 2009 at 9:17 PM, Ahmet Kilic wrote: > > functs = Array.new > > str.scan(/^\s*function\s*([^(]+)\(([^)]+)/).map do |name,args| > name.gsub!(/\s/,'') > args.gsub!(/\s/,'') > functs << ParsedFunction.new( name , args.split(/;/).map{|arg| > arg.split(/:/) } ) > end Either you should not be using #map above or assign the result of #map to functs. A #map without using the result is pretty useless. But definitively #scan is the right tool for the job. If only printing of function names and arguments is interesting that could be done inside the #scan body as well avoiding a second pass. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/