Module: Imgproxy::OptionsCasters::Alpha
- Defined in:
- lib/imgproxy/options_casters/alpha.rb
Overview
Casts ‘alpha` info option
Constant Summary collapse
- CASTER =
Imgproxy::OptionsCasters::Group.new( alpha: Imgproxy::OptionsCasters::Bool, check_transparency: Imgproxy::OptionsCasters::Bool, ).freeze
Class Method Summary collapse
Class Method Details
.cast(raw) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/imgproxy/options_casters/alpha.rb', line 15 def self.cast(raw) # Allow alpha to be just a boolean return Imgproxy::OptionsCasters::Bool.cast(raw) if [true, false].include?(raw) return raw unless raw.is_a?(Hash) return if raw[:alpha].nil? values = CASTER.cast(raw) values[0].zero? ? 0 : values end |