Class: Omnizip::Profile::CustomProfile::Builder
- Inherits:
-
Object
- Object
- Omnizip::Profile::CustomProfile::Builder
- Defined in:
- lib/omnizip/profile/custom_profile.rb
Overview
Builder for creating custom profiles
Instance Attribute Summary collapse
-
#algorithm ⇒ Object
Returns the value of attribute algorithm.
-
#base_profile ⇒ Object
Returns the value of attribute base_profile.
-
#description ⇒ Object
Returns the value of attribute description.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#solid ⇒ Object
Returns the value of attribute solid.
Instance Method Summary collapse
-
#build ⇒ CustomProfile
Build the custom profile.
-
#initialize(name, base_profile = nil) ⇒ Builder
constructor
Initialize a new builder.
-
#valid? ⇒ Boolean
Validate builder settings.
Constructor Details
#initialize(name, base_profile = nil) ⇒ Builder
Initialize a new builder
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/omnizip/profile/custom_profile.rb', line 19 def initialize(name, base_profile = nil) @name = name if base_profile # Inherit settings from base profile @algorithm = base_profile.algorithm @level = base_profile.level @filter = base_profile.filter @solid = base_profile.solid @description = base_profile.description @base_profile = base_profile else # Default settings @algorithm = :deflate @level = 6 @filter = nil @solid = false @description = "" @base_profile = nil end end |
Instance Attribute Details
#algorithm ⇒ Object
Returns the value of attribute algorithm.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def algorithm @algorithm end |
#base_profile ⇒ Object
Returns the value of attribute base_profile.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def base_profile @base_profile end |
#description ⇒ Object
Returns the value of attribute description.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def description @description end |
#filter ⇒ Object
Returns the value of attribute filter.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def filter @filter end |
#level ⇒ Object
Returns the value of attribute level.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def name @name end |
#solid ⇒ Object
Returns the value of attribute solid.
12 13 14 |
# File 'lib/omnizip/profile/custom_profile.rb', line 12 def solid @solid end |
Instance Method Details
#build ⇒ CustomProfile
Build the custom profile
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/omnizip/profile/custom_profile.rb', line 44 def build CustomProfile.new( name: name, algorithm: algorithm, level: level, filter: filter, solid: solid, description: description, base_profile: base_profile, ) end |
#valid? ⇒ Boolean
Validate builder settings
60 61 62 63 64 65 66 |
# File 'lib/omnizip/profile/custom_profile.rb', line 60 def valid? validate_name! validate_algorithm! validate_level! validate_filter! true end |