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.



49
50
51
52
# File 'lib/issue_beaver/models/merger.rb', line 49

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

Instance Method Details

#matchesObject



55
56
57
58
59
60
61
62
63
64
# File 'lib/issue_beaver/models/merger.rb', line 55

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