Module: Imgproxy::OptionsCasters::Hashsum

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

Overview

Casts ‘hashsum` info option

Constant Summary collapse

CASTER =
Imgproxy::OptionsCasters::Group.new(
  hashsum_type: Imgproxy::OptionsCasters::String,
  hashsum: Imgproxy::OptionsCasters::String,
).freeze

Class Method Summary collapse

Class Method Details

.cast(raw) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/imgproxy/options_casters/hashsum.rb', line 15

def self.cast(raw)
  return raw unless raw.is_a?(Hash)
  return if raw[:hashsum_type].nil?

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