class SourceAnnotationExtractor
def extract_annotations_from(file, pattern)
a hash with a single entry that maps +file+ to an array of its annotations.
If +file+ is the filename of a file that contains annotations this method returns
def extract_annotations_from(file, pattern) lineno = 0 result = File.readlines(file).inject([]) do |list, line| lineno += 1 next list unless line =~ pattern list << Annotation.new(lineno, $1, $2) end result.empty? ? {} : { file => result } end