Class: IssueBeaver::Models::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/issue_beaver/models/merger.rb

Instance Method Summary collapse

Constructor Details

#initialize(issues, todos) ⇒ Matcher

Returns a new instance of Matcher.



64
65
66
67
# File 'lib/issue_beaver/models/merger.rb', line 64

def initialize(issues, todos)
  @issue_matcher = IssueMatcher.new(issues)
  @todos = todos
end

Instance Method Details

#matchesObject



70
71
72
73
74
75
76
77
78
79
# File 'lib/issue_beaver/models/merger.rb', line 70

def matches
  @matches ||=
    Enumerator.new do |yielder|
      @todos.each do |todo|
        match = @issue_matcher.find_and_check_off(todo)
        issue = match ? match.issue : nil
        yielder << [todo, issue]
      end
    end.memoizing.lazy
end