Class: Lazylead::Records
- Inherits:
-
Attachment
- Object
- Requirement
- Attachment
- Lazylead::Records
- Defined in:
- lib/lazylead/task/accuracy/records.rb
Overview
Check that ticket has video record(s) with reproducing results.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Requirement
Instance Method Summary collapse
-
#initialize(ext = [], size = 5 * 1024) ⇒ Records
constructor
A new instance of Records.
-
#matches?(attach) ⇒ Boolean
Ensure that ticket has an attachment with video-file extension.
Methods inherited from Attachment
Methods inherited from Requirement
Constructor Details
#initialize(ext = [], size = 5 * 1024) ⇒ Records
Returns a new instance of Records.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lazylead/task/accuracy/records.rb', line 35 def initialize(ext = [], size = 5 * 1024) super("Internal reproducing results (video)", 5, "Attachments") @ext = ext @size = size 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 .wrf] end |
Instance Method Details
#matches?(attach) ⇒ Boolean
Ensure that ticket has an attachment with video-file extension
47 48 49 50 51 52 |
# File 'lib/lazylead/task/accuracy/records.rb', line 47 def matches?(attach) return false if attach.attrs["size"].to_i < @size 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"].end_with? "/#{e[1..]}" } end |