Module: Imgproxy::OptionsCasters::VideoThumbnailTile

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

Overview

Casts ‘video_thumbnail_tile` processing option

Constant Summary collapse

CASTER =
Imgproxy::OptionsCasters::Group.new(
  step: Imgproxy::OptionsCasters::Float,
  columns: Imgproxy::OptionsCasters::Integer,
  rows: Imgproxy::OptionsCasters::Integer,
  tile_width: Imgproxy::OptionsCasters::Integer,
  tile_height: Imgproxy::OptionsCasters::Integer,
  extend_tile: Imgproxy::OptionsCasters::Bool,
  trim: Imgproxy::OptionsCasters::Bool,
).freeze

Class Method Summary collapse

Class Method Details

.cast(raw) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/imgproxy/options_casters/video_thumbnail_tile.rb', line 22

def self.cast(raw)
  # Allow video_thumbnail_tile to be just a zero
  return 0 if raw.is_a?(Numeric) && raw.zero?

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

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