From: Zach Dennis Date: 2004-08-20T12:01:41+09:00 Subject: Re: MatchData.each method.....no "next" ? I found my problem: m.each{ |v| ...} is giving me "v" as an array of matches....I should have tested first! Zach Zach Dennis wrote: > I've got a block of code: > > process = proc { |str,val| > process_hsh = { "String" => true , "Fixnum" => true } > re = /\((.*)\)|\{(.*)\}/; > m = str.scan( re ) > if( process_hsh["#{val.class.to_s}"] ) then > m.each{ |v| > next if( not v); #<-----------------THIS IS THE CULPRIT > puts v > } > end > } > > > But "v" is always put to the screen. The output I get is: > > * > nil > * > nil > * > nil > * > nil > > In my test case, I am expecting: > > * > * > * > * > > Does MatchData not take advantage of iterating via "next" ? Thanks, > > Zach > > >