Module: Imgproxy::OptionsCasters::BlurDetections
- Defined in:
- lib/imgproxy/options_casters/blur_detections.rb
Overview
Casts ‘blur_detections` processing option
Class Method Summary collapse
Class Method Details
.cast(raw) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/imgproxy/options_casters/blur_detections.rb', line 13 def self.cast(raw) # Allow blur_detections to be just a numeric return Imgproxy::OptionsCasters::Float.cast(raw) if raw.is_a?(Numeric) return raw unless raw.is_a?(Hash) return unless raw[:sigma] values = [ Imgproxy::OptionsCasters::Float.cast(raw[:sigma]), *Imgproxy::OptionsCasters::Array.cast(raw[:class_names]), ].trim! values[0].zero? ? 0 : values end |