Module: Boxify::Dimensionable
Instance Attribute Summary collapse
-
#depth ⇒ Object
Returns the value of attribute depth.
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
Instance Attribute Details
#depth ⇒ Object
Returns the value of attribute depth.
3 4 5 |
# File 'lib/boxify/dimensionable.rb', line 3 def depth @depth end |
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/boxify/dimensionable.rb', line 3 def height @height end |
#width ⇒ Object
Returns the value of attribute width.
3 4 5 |
# File 'lib/boxify/dimensionable.rb', line 3 def width @width end |
Instance Method Details
#area ⇒ Object
5 6 7 |
# File 'lib/boxify/dimensionable.rb', line 5 def area width * depth end |
#surface_area ⇒ Object
13 14 15 |
# File 'lib/boxify/dimensionable.rb', line 13 def surface_area (2 * height * width) + (2 * height * depth) + (2 * width * depth) end |
#volume ⇒ Object
9 10 11 |
# File 'lib/boxify/dimensionable.rb', line 9 def volume width * height * depth end |