Class: Omnizip::Profile::ArchiveProfile
- Inherits:
-
CompressionProfile
- Object
- CompressionProfile
- Omnizip::Profile::ArchiveProfile
- Defined in:
- lib/omnizip/profile/archive_profile.rb
Overview
Archive compression profile
For files that are already compressed. Uses Store (no compression) to avoid wasting CPU time on files that cannot be compressed further.
Instance Attribute Summary
Attributes inherited from CompressionProfile
#algorithm, #description, #filter, #level, #name, #solid
Instance Method Summary collapse
-
#initialize ⇒ ArchiveProfile
constructor
Initialize archive profile.
-
#suitable_for?(mime_type) ⇒ Boolean
Check if this profile is suitable for a MIME type.
Methods inherited from CompressionProfile
#apply_to, #inspect, #to_h, #to_s
Constructor Details
#initialize ⇒ ArchiveProfile
Initialize archive profile
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/omnizip/profile/archive_profile.rb', line 12 def initialize super( name: :archive, algorithm: :store, level: 0, filter: nil, solid: false, description: "No compression (already compressed files)" ) end |
Instance Method Details
#suitable_for?(mime_type) ⇒ Boolean
Check if this profile is suitable for a MIME type
27 28 29 30 31 32 33 |
# File 'lib/omnizip/profile/archive_profile.rb', line 27 def suitable_for?(mime_type) return true unless mime_type # Suitable for archives and media files (already compressed) FileType::MimeClassifier.archive?(mime_type) || FileType::MimeClassifier.media?(mime_type) end |