module Imgproxy::OptionsCasters::Extend

Casts extend option

Constants

CASTER

Public Class Methods

cast(raw) click to toggle source
# File lib/imgproxy/options_casters/extend.rb, line 14
def self.cast(raw)
  # Allow extend to be just a boolean
  return Imgproxy::OptionsCasters::Bool.cast(raw) if [true, false].include?(raw)

  return raw unless raw.is_a?(Hash)
  return if raw[:extend].nil?

  values = CASTER.cast(raw)
  values[0].zero? ? 0 : values
end