Class: Woody::Decorators::Helper::AspectRatio
- Inherits:
-
Object
- Object
- Woody::Decorators::Helper::AspectRatio
- Defined in:
- lib/woody/decorators/helper/aspect_ratio.rb
Instance Method Summary collapse
- #class_name ⇒ Object
-
#initialize(height, width) ⇒ AspectRatio
constructor
A new instance of AspectRatio.
Constructor Details
#initialize(height, width) ⇒ AspectRatio
Returns a new instance of AspectRatio.
5 6 7 8 |
# File 'lib/woody/decorators/helper/aspect_ratio.rb', line 5 def initialize(height, width) @height = height @width = width end |
Instance Method Details
#class_name ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/woody/decorators/helper/aspect_ratio.rb', line 10 def class_name return format_class_name('landscape', '16-9') unless valid_dimensions case ratio when '1:1' 'square' when '16:9', '4:3', '9:16', '4:5', '3:4' format(CLASS_NAME_FORMAT, orientation, ratio('-')) else format(CLASS_NAME_FORMAT, orientation, default_ratio) end end |