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.
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
#degree ⇒ Object
120 121 122 |
# File 'lib/issue_beaver/models/merger.rb', line 120 def degree title_degree end |
#sane? ⇒ Boolean
115 116 117 |
# File 'lib/issue_beaver/models/merger.rb', line 115 def sane? (title_degree < TITLE_THRESHOLD) && (title_length > TITLE_LENGTH) end |
#title_degree ⇒ Object
125 |
# File 'lib/issue_beaver/models/merger.rb', line 125 def title_degree() levenshtein(@issue.title, @todo.title) end |
#title_length ⇒ Object
127 |
# File 'lib/issue_beaver/models/merger.rb', line 127 def title_length() [@issue.title.to_s.length, @todo.title.to_s.length].min end |