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.2
- TITLE_LENGTH =
8
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
- #degree ⇒ Object
-
#initialize(todo, issue) ⇒ Match
constructor
A new instance of Match.
- #sane? ⇒ Boolean
- #title_degree ⇒ Object
- #title_length ⇒ Object
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
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
127 128 129 |
# File 'lib/issue_beaver/models/merger.rb', line 127 def issue @issue end |
#todo ⇒ Object (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
#degree ⇒ Object
135 136 137 |
# File 'lib/issue_beaver/models/merger.rb', line 135 def degree title_degree end |
#sane? ⇒ 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_degree ⇒ Object
140 |
# File 'lib/issue_beaver/models/merger.rb', line 140 def title_degree() levenshtein(@issue.title, @todo.title) end |
#title_length ⇒ Object
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 |