lib/glyptodont/todo_researcher.rb in glyptodont-0.1.0 vs lib/glyptodont/todo_researcher.rb in glyptodont-0.2.0

- old
+ new

@@ -7,10 +7,11 @@ # Finds all the TODOs in a directory managed by Git, who last touched them and when. class TodoResearcher def initialize(directory, ignore) @directory = directory @ignore = ignore + @annotator = {} end def research annotate(exclude_ignored(extract_details(git.grep(keyword_rexexp)))) end @@ -63,10 +64,11 @@ def annotate_line(file_path:, line_number:) line_info(file_path: file_path, line_number: line_number)[:final_signature] end def line_info(file_path:, line_number:) - Rugged::Blame.new(repository, file_path).for_line(line_number) + @annotator[file_path] ||= Rugged::Blame.new(repository, file_path) + @annotator[file_path].for_line(line_number) end def repository @repository ||= Rugged::Repository.new(directory) end