Class: Lazylead::LogsLink
- Inherits:
-
Logs
- Object
- Requirement
- Attachment
- Logs
- Lazylead::LogsLink
- Defined in:
- lib/lazylead/task/accuracy/logs_link.rb
Overview
Check that ticket has link/reference to log record(s) in another system like ELK, GrayLog, etc.
or attachment with plain log file
Instance Attribute Summary
Attributes inherited from Requirement
Instance Method Summary collapse
-
#initialize(link) ⇒ LogsLink
constructor
A new instance of LogsLink.
-
#link?(issue) ⇒ Boolean
Ensure that ticket has a link to external logs system like ELK, GrayLog, etc.
- #passed(issue) ⇒ Object
Methods inherited from Logs
Methods inherited from Attachment
Methods inherited from Requirement
Constructor Details
#initialize(link) ⇒ LogsLink
Returns a new instance of LogsLink.
32 33 34 35 |
# File 'lib/lazylead/task/accuracy/logs_link.rb', line 32 def initialize(link) super() @link = link end |
Instance Method Details
#link?(issue) ⇒ Boolean
Ensure that ticket has a link to external logs system like ELK, GrayLog, etc.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lazylead/task/accuracy/logs_link.rb', line 43 def link?(issue) return false if issue.description.nil? issue.description .split("\n") .reject(&:blank?) .flat_map(&:split) .reject(&:blank?) .any? do |word| @link.is_a?(Array) ? @link.any? { |l| word.include? l } : word.include?(@link) end end |
#passed(issue) ⇒ Object
37 38 39 40 |
# File 'lib/lazylead/task/accuracy/logs_link.rb', line 37 def passed(issue) return false if @link.nil? || (@link.is_a?(Array) && @link.empty?) super(issue) || link?(issue) end |