Module: Imgproxy::OptionsCasters::Filename
- Defined in:
- lib/imgproxy/options_casters/filename.rb
Overview
Casts ‘filename` processing option
Constant Summary collapse
- CASTER =
Imgproxy::OptionsCasters::Group.new( filename: Imgproxy::OptionsCasters::String, encoded: Imgproxy::OptionsCasters::Bool, ).freeze
Class Method Summary collapse
Class Method Details
.cast(raw) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/imgproxy/options_casters/filename.rb', line 17 def self.cast(raw) return raw unless raw.is_a?(Hash) return if raw[:filename].nil? encoded = Imgproxy::OptionsCasters::Bool.cast(raw[:encoded]) if encoded.nil? || encoded.zero? return Imgproxy::OptionsCasters::String.cast(raw[:filename]) end [Imgproxy::OptionsCasters::Base64.cast(raw[:filename]), 1] end |