app/models/has_aspect_ratio.rb
# returns the aspect ratio of the interactive, dividing the width by the height.
# For an interactive with a native width of 400 and native height of 200,
# the aspect_ratio will be 2.
# If ASPECT_RATIO_MAX_METHOD is being used, it is expected that the available
# width and height are provided as arugments used to calculated an aspect_ratio
returns the aspect ratio of the interactive, dividing the width by the height.
For an interactive with a native width of 400 and native height of 200,
the aspect_ratio will be 2.
If ASPECT_RATIO_MAX_METHOD is being used, it is expected that the available
width and height are provided as arugments used to calculated an aspect_ratio
returns the aspect ratio of the interactive dividing the width by the height . For an interactive with a native width of 400 and native height of 200 the aspect_ratio will be 2 . If ASPECT_RATIO_MAX_METHOD is being used it is expected that the available width and height are provided as arugments used to calculated an aspect_ratio
def aspect_ratio(avail_width=nil, avail_height=nil)
    case self.aspect_ratio_method
      when ASPECT_RATIO_DEFAULT_METHOD
        return ASPECT_RATIO_DEFAULT_WIDTH / ASPECT_RATIO_DEFAULT_HEIGHT.to_f
      when ASPECT_RATIO_MANUAL_METHOD
        return self.native_width/self.native_height.to_f
      when ASPECT_RATIO_MAX_METHOD
        width  = avail_width  || ASPECT_RATIO_DEFAULT_WIDTH
        height = avail_height || ASPECT_RATIO_DEFAULT_HEIGHT
        return width / height.to_f
    end
  end
def aspect_ratio ( avail_width = nil , avail_height = nil ) case self . aspect_ratio_method when ASPECT_RATIO_DEFAULT_METHOD return ASPECT_RATIO_DEFAULT_WIDTH / ASPECT_RATIO_DEFAULT_HEIGHT . to_f when ASPECT_RATIO_MANUAL_METHOD return self . native_width / self . native_height . to_f when ASPECT_RATIO_MAX_METHOD width = avail_width || ASPECT_RATIO_DEFAULT_WIDTH height = avail_height || ASPECT_RATIO_DEFAULT_HEIGHT return width / height . to_f end end
returns the aspect ratio of the interactive, dividing the width by the height.
returns the aspect ratio of the interactive dividing the width by the height .
avail_width
<not_specific>
avail_height
<not_specific>