Class: Lazylead::Logs

Inherits:
Attachment show all
Defined in:
lib/lazylead/task/accuracy/logs.rb

Overview

Check that ticket has log file(s) in attachment.

Instance Attribute Summary

Attributes inherited from Requirement

#desc, #field, #score

Instance Method Summary collapse

Methods inherited from Attachment

#passed

Methods inherited from Requirement

#blank?, #non_blank?, #passed

Constructor Details

#initializeLogs

Returns a new instance of Logs.



30
31
32
# File 'lib/lazylead/task/accuracy/logs.rb', line 30

def initialize
  super("Log files", 2, "Attachments")
end

Instance Method Details

#matching(attachment) ⇒ Object

Ensure that ticket has a ‘*.log’ file more ‘5KB’



35
36
37
38
39
40
# File 'lib/lazylead/task/accuracy/logs.rb', line 35

def matching(attachment)
  name = attachment.attrs["filename"].downcase
  return false unless attachment.attrs["size"].to_i > 5120
  return true if File.extname(name).start_with?(".log", ".txt")
  %w[.log.zip .log.gz .log.tar.gz].any? { |l| name.end_with? l }
end