Class: Lazylead::HasLabel
- Inherits:
-
Requirement
- Object
- Requirement
- Lazylead::HasLabel
- Defined in:
- lib/lazylead/task/accuracy/has_label.rb
Overview
Check that ticket has specified label.
Instance Attribute Summary
Attributes inherited from Requirement
Instance Method Summary collapse
-
#initialize(label, desc: "Has label", score: 0.5) ⇒ HasLabel
constructor
A new instance of HasLabel.
-
#match?(label) ⇒ Boolean
Ensure that particular label matches expected label.
- #passed(issue) ⇒ Object
Methods inherited from Requirement
Constructor Details
#initialize(label, desc: "Has label", score: 0.5) ⇒ HasLabel
Returns a new instance of HasLabel.
33 34 35 36 |
# File 'lib/lazylead/task/accuracy/has_label.rb', line 33 def initialize(label, desc: "Has label", score: 0.5) super(desc, score, "Labels") @label = label end |
Instance Method Details
#match?(label) ⇒ Boolean
Ensure that particular label matches expected label.
44 45 46 |
# File 'lib/lazylead/task/accuracy/has_label.rb', line 44 def match?(label) @label.eql? label end |
#passed(issue) ⇒ Object
38 39 40 41 |
# File 'lib/lazylead/task/accuracy/has_label.rb', line 38 def passed(issue) return false if issue.labels.empty? issue.labels.any? { |l| match?(l) } end |