Module: Imgproxy::OptionsCasters::Zoom
- Defined in:
- lib/imgproxy/options_casters/zoom.rb
Overview
Casts zoom info option
Class Method Summary collapse
Class Method Details
.cast(raw) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/imgproxy/options_casters/zoom.rb', line 12 def self.cast(raw) # Allow zoom to be just a float return Imgproxy::OptionsCasters::Float.cast(raw) if raw.is_a?(Numeric) return raw unless raw.is_a?(Hash) return Imgproxy::OptionsCasters::Float.cast(raw[:zoom_x_y]) if raw.key?(:zoom_x_y) [ Imgproxy::OptionsCasters::Float.cast(raw[:zoom_x]) || 1, Imgproxy::OptionsCasters::Float.cast(raw[:zoom_y]) || 1, ].trim! end |