Module: Imgproxy::OptionsCasters::Autoquality

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

Overview

Casts ‘autoquality` processing option

Constant Summary collapse

CASTER =
Imgproxy::OptionsCasters::Group.new(
  method: Imgproxy::OptionsCasters::String,
  target: Imgproxy::OptionsCasters::Float,
  min_quality: Imgproxy::OptionsCasters::Integer,
  max_quality: Imgproxy::OptionsCasters::Integer,
  allowed_error: Imgproxy::OptionsCasters::Float,
).freeze

Class Method Summary collapse

Class Method Details

.cast(raw) ⇒ Object



20
21
22
23
24
25
# File 'lib/imgproxy/options_casters/autoquality.rb', line 20

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

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