module Imgproxy::OptionsCasters::Size

Casts size option

Public Class Methods

cast(raw) click to toggle source
# 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