Here's the code I'm debugging:

    def self.find(name)
      files = self.listnames
      if files
        stem = Regexp.new Regexp.quote name.downcase.gsub(' ','-')
        Wunderbar.warn "EmeritusFiles.find #{files}"
        Wunderbar.warn "EmeritusFiles.find stem: #{stem}"
        files.each do |file|
          Wunderbar.warn "EmeritusFiles.find #{stem} in #{file}"
          break file if stem =~ file
        end
      end
    end

What I want is to return the string (actual file name) which represents a match 
to the pattern formed by the name with blanks replaced by \- because - is a 
special character in regex.

What actually happens is that the each loop doesn't break out but instead 
returns all of the files. I don't know exactly what is returned but it shows up 
as a series of file names separated by commas.

Anyone see the obvious bug here?

Thanks,
Craig


Craig L Russell
c...@apache.org

Reply via email to