Class: Omnizip::Profile::CustomProfile
- Inherits:
-
CompressionProfile
- Object
- CompressionProfile
- Omnizip::Profile::CustomProfile
- Defined in:
- lib/omnizip/profile/custom_profile.rb
Overview
Custom user-defined compression profile
Allows users to create custom profiles with specific settings. Supports builder pattern for fluent API and profile inheritance.
Defined Under Namespace
Classes: Builder
Instance Attribute Summary collapse
-
#base_profile ⇒ Object
readonly
Returns the value of attribute base_profile.
Attributes inherited from CompressionProfile
#algorithm, #description, #filter, #level, #name, #solid
Instance Method Summary collapse
-
#initialize(name:, algorithm:, level:, filter: nil, solid: false, description: "", base_profile: nil) ⇒ CustomProfile
constructor
Initialize a custom profile.
-
#suitable_for?(file_type) ⇒ Boolean
Check if this profile is suitable for a file type.
-
#to_h ⇒ Hash
Convert to hash with base profile information.
Methods inherited from CompressionProfile
Constructor Details
#initialize(name:, algorithm:, level:, filter: nil, solid: false, description: "", base_profile: nil) ⇒ CustomProfile
Initialize a custom profile
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/omnizip/profile/custom_profile.rb', line 114 def initialize( name:, algorithm:, level:, filter: nil, solid: false, description: "", base_profile: nil ) @base_profile = base_profile super( name: name, algorithm: algorithm, level: level, filter: filter, solid: solid, description: description ) end |
Instance Attribute Details
#base_profile ⇒ Object (readonly)
Returns the value of attribute base_profile.
103 104 105 |
# File 'lib/omnizip/profile/custom_profile.rb', line 103 def base_profile @base_profile end |
Instance Method Details
#suitable_for?(file_type) ⇒ Boolean
Check if this profile is suitable for a file type
138 139 140 141 142 143 |
# File 'lib/omnizip/profile/custom_profile.rb', line 138 def suitable_for?(file_type) return base_profile.suitable_for?(file_type) if base_profile # Custom profiles are suitable for all file types by default true end |
#to_h ⇒ Hash
Convert to hash with base profile information
148 149 150 151 152 |
# File 'lib/omnizip/profile/custom_profile.rb', line 148 def to_h hash = super hash[:base_profile] = base_profile.name if base_profile hash end |