Module: Imgproxy::OptionsCasters::Size

Defined in:
lib/imgproxy/options_casters/size.rb

Overview

Casts ‘size` processing option

Class Method Summary collapse

Class Method Details

.cast(raw) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/imgproxy/options_casters/size.rb', line 14

def self.cast(raw)
  return raw unless raw.is_a?(Hash)

  [
    Imgproxy::OptionsCasters::Integer.cast(raw[:width]) || 0,
    Imgproxy::OptionsCasters::Integer.cast(raw[:height]) || 0,
    Imgproxy::OptionsCasters::Bool.cast(raw[:enlarge]),
    Imgproxy::OptionsCasters::Extend.cast(raw[:extend]),
  ].trim!
end