Class: Lazylead::Logs
- Inherits:
-
Attachment
- Object
- Requirement
- Attachment
- Lazylead::Logs
- 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
Instance Method Summary collapse
-
#initialize(files = %w[log.zip logs.zip log.gz logs.gz log.tar.gz logs.tar.gz log.7z logs.7z log.tar logs.tar])) ⇒ Logs
constructor
A new instance of Logs.
-
#matches?(attachment) ⇒ Boolean
Ensure that ticket has a ‘*.log’ file more ‘5KB’.
Methods inherited from Attachment
Methods inherited from Requirement
Constructor Details
#initialize(files = %w[log.zip logs.zip log.gz logs.gz log.tar.gz logs.tar.gz log.7z logs.7z log.tar logs.tar])) ⇒ Logs
Returns a new instance of Logs.
30 31 32 33 34 |
# File 'lib/lazylead/task/accuracy/logs.rb', line 30 def initialize(files = %w[log.zip logs.zip log.gz logs.gz log.tar.gz logs.tar.gz log.7z logs.7z log.tar logs.tar]) super("Log files", 2, "Attachments") @files = files end |
Instance Method Details
#matches?(attachment) ⇒ Boolean
Ensure that ticket has a ‘*.log’ file more ‘5KB’
37 38 39 40 41 42 43 44 45 |
# File 'lib/lazylead/task/accuracy/logs.rb', line 37 def matches?() name = .attrs["filename"].downcase return false unless .attrs["size"].to_i > 5120 return true if File.extname(name).start_with? ".log", ".txt", ".out" return true if @files.any? { |l| name.end_with? l } %w[.zip .7z .gz tar.gz].any? do |l| name.end_with?(l) && name.split(/(?:[^a-zA-Z0-9](?<![^\x00-\x7F]))+/).include?("logs") end end |