Module: Imgproxy::OptionsCasters::Size

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

Overview

Casts size option

Class Method Summary collapse

Class Method Details

.cast(raw) ⇒ Object



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

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