Class: SafeImage::OperationBackends::Base
- Inherits:
-
Object
- Object
- SafeImage::OperationBackends::Base
- Defined in:
- lib/safe_image/operation_backends/base.rb
Overview
Shared operation-strategy plumbing: path normalization, max-pixel config, optimizer post-processing and uniform Result construction.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #frame_count(path, max_pixels: nil) ⇒ Object
-
#initialize(config:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(config:) ⇒ Base
Returns a new instance of Base.
12 13 14 |
# File 'lib/safe_image/operation_backends/base.rb', line 12 def initialize(config:) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/safe_image/operation_backends/base.rb', line 10 def config @config end |
Instance Method Details
#frame_count(path, max_pixels: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/safe_image/operation_backends/base.rb', line 16 def frame_count(path, max_pixels: nil) max_pixels = resolved_max_pixels(max_pixels) # ico directories are counted by the pure-Ruby parser on either backend; # everything else is a header-only count. if File.extname(PathSafety.local_path(path)).downcase == ".ico" return Ico.frame_count(path, max_pixels: max_pixels) end backend_frame_count(path, max_pixels: max_pixels) end |