module Imgproxy::OptionsCasters::Watermark

Casts string option

Constants

CASTER

Public Class Methods

cast(raw) click to toggle source
# File lib/imgproxy/options_casters/watermark.rb, line 18
def self.cast(raw)
  # Allow watermark to be just a numeric
  return Imgproxy::OptionsCasters::Float.cast(raw) if raw.is_a?(Numeric)

  return raw unless raw.is_a?(Hash)
  return unless raw[:opacity]

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