Class: Danger::DiffTodoFinder
- Inherits:
-
Object
- Object
- Danger::DiffTodoFinder
- Defined in:
- lib/todoist/diff_todo_finder.rb
Overview
Identify todos in a set of diffs
Instance Method Summary collapse
- #call(diffs) ⇒ Object
-
#initialize(keywords) ⇒ DiffTodoFinder
constructor
A new instance of DiffTodoFinder.
Constructor Details
#initialize(keywords) ⇒ DiffTodoFinder
Returns a new instance of DiffTodoFinder.
4 5 6 |
# File 'lib/todoist/diff_todo_finder.rb', line 4 def initialize(keywords) @regexp = todo_regexp(keywords) end |
Instance Method Details
#call(diffs) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/todoist/diff_todo_finder.rb', line 8 def call(diffs) diffs .map { |diff| MatchesInDiff.new(diff, diff.patch.scan(@regexp)) } .select(&:todo_matches?) .map(&:all_todos) .flatten end |