lib/papercrop/model_extension.rb
# Returns a valid and normalized value for aspect ratio
# It will return 1.. if aspect is nil or a invalid string
# @param aspect [Range, String, FalseClass]
# 
# @return [Range]
Returns a valid and normalized value for aspect ratio
It will return 1.. if aspect is nil or a invalid string
Returns a valid and normalized value for aspect ratio It will return 1 .. if aspect is nil or a invalid string
def normalize_aspect(aspect)
        if aspect.kind_of?(String) && aspect =~ Papercrop::RegExp::ASPECT
          Range.new *aspect.split(':').map(&:to_i)
        elsif aspect.kind_of?(Range)
          return aspect.first.to_i..aspect.last.to_i
        elsif aspect == false
          return aspect
        else
          1..1
        end
      end
def normalize_aspect ( aspect ) if aspect . kind_of? ( String ) && aspect =~ Papercrop :: RegExp :: ASPECT Range . new * aspect . split ( ':' ) . map ( & :to_i ) elsif aspect . kind_of? ( Range ) return aspect . first . to_i .. aspect . last . to_i elsif aspect == false return aspect else 1 .. 1 end end
Returns a valid and normalized value for aspect ratio
It will return 1.. if aspect is nil or a invalid string
Returns a valid and normalized value for aspect ratio It will return 1 .. if aspect is nil or a invalid string
None
Range
aspect
<not_specific>
<not_specific>
None