Class: IssueBeaver::Models::IssueMatcher::Match
- Inherits:
-
Object
- Object
- IssueBeaver::Models::IssueMatcher::Match
- Defined in:
- lib/issue_beaver/models/merger.rb
Constant Summary collapse
- TITLE_THRESHOLD =
0.4
- BODY_THRESHOLD =
0.9
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
-
#todo ⇒ Object
readonly
Returns the value of attribute todo.
Instance Method Summary collapse
- #body_accuracy ⇒ Object
- #body_degree ⇒ Object
- #degree ⇒ Object
-
#initialize(todo, issue) ⇒ Match
constructor
A new instance of Match.
- #sane? ⇒ Boolean
- #title_degree ⇒ Object
Constructor Details
#initialize(todo, issue) ⇒ Match
Returns a new instance of Match.
107 108 109 110 |
# File 'lib/issue_beaver/models/merger.rb', line 107 def initialize(todo, issue) @todo = todo @issue = issue end |
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
112 113 114 |
# File 'lib/issue_beaver/models/merger.rb', line 112 def issue @issue end |
#todo ⇒ Object (readonly)
Returns the value of attribute todo.
112 113 114 |
# File 'lib/issue_beaver/models/merger.rb', line 112 def todo @todo end |
Instance Method Details
#body_accuracy ⇒ Object
132 |
# File 'lib/issue_beaver/models/merger.rb', line 132 def body_accuracy() 1.0/[@issue.body.to_s.length, @todo.body.to_s.length].min.to_f end |
#body_degree ⇒ Object
129 |
# File 'lib/issue_beaver/models/merger.rb', line 129 def body_degree() levenshtein(@issue.body, @todo.body) end |
#degree ⇒ Object
121 122 123 |
# File 'lib/issue_beaver/models/merger.rb', line 121 def degree title_degree + (body_degree * 0.25) end |
#sane? ⇒ Boolean
115 116 117 118 |
# File 'lib/issue_beaver/models/merger.rb', line 115 def sane? (title_degree < TITLE_THRESHOLD) || ((body_degree < BODY_THRESHOLD) && (body_accuracy < 0.1)) end |
#title_degree ⇒ Object
126 |
# File 'lib/issue_beaver/models/merger.rb', line 126 def title_degree() levenshtein(@issue.title, @todo.title) end |