Class: IssueBeaver::Models::IssueMatcher::Match

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

Constant Summary collapse

TITLE_THRESHOLD =
0.2
TITLE_LENGTH =
8

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(todo, issue) ⇒ Match

Returns a new instance of Match.



122
123
124
125
# File 'lib/issue_beaver/models/merger.rb', line 122

def initialize(todo, issue)
  @todo = todo
  @issue = issue
end

Instance Attribute Details

#issueObject (readonly)

Returns the value of attribute issue.



127
128
129
# File 'lib/issue_beaver/models/merger.rb', line 127

def issue
  @issue
end

#todoObject (readonly)

Returns the value of attribute todo.



127
128
129
# File 'lib/issue_beaver/models/merger.rb', line 127

def todo
  @todo
end

Instance Method Details

#degreeObject



135
136
137
# File 'lib/issue_beaver/models/merger.rb', line 135

def degree
  title_degree
end

#sane?Boolean

Returns:

  • (Boolean)


130
131
132
# File 'lib/issue_beaver/models/merger.rb', line 130

def sane?
  (title_degree < TITLE_THRESHOLD) && (title_length > TITLE_LENGTH)
end

#title_degreeObject



140
# File 'lib/issue_beaver/models/merger.rb', line 140

def title_degree() levenshtein(@issue.title, @todo.title) end

#title_lengthObject



142
# File 'lib/issue_beaver/models/merger.rb', line 142

def title_length() [@issue.title.to_s.length, @todo.title.to_s.length].min end