Class: Lazylead::Records

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

Overview

Check that ticket has video record(s) with reproducing results.

Direct Known Subclasses

RecordsLink

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

#initialize(ext = []) ⇒ Records



30
31
32
33
34
35
36
37
38
# File 'lib/lazylead/task/accuracy/records.rb', line 30

def initialize(ext = [])
  super("Internal reproducing results (video)", 5, "Attachments")
  @ext = ext
  return unless @ext.empty?
  @ext = %w[.webm .mkv .flv .flv .vob .ogv .ogg .drc .gif .gifv .mng .avi
            .mts .m2ts .ts .mov .qt .wmv .yuv .rm .rmvb .viv .asf .amv .mp4
            .m4p .m4v .mpg .mp2 .mpeg .mpe .mpv .mpg .mpeg .m2v .m4v .svi
            .3gp .3g2 .mxf .roq .nsv .flv .f4v .f4p .f4a .f4b .gif]
end

Instance Method Details

#matches?(attach) ⇒ Boolean

Ensure that ticket has an attachment with video-file extension



41
42
43
44
45
# File 'lib/lazylead/task/accuracy/records.rb', line 41

def matches?(attach)
  return true if @ext.any? { |e| e.eql? File.extname(attach.attrs["filename"]).downcase }
  return false if attach.attrs["mimeType"].nil?
  @ext.any? { |e| attach.attrs["mimeType"].include? e[1..] }
end