Module: Boxify::Dimensionable

Included in:
Box, Container, Space
Defined in:
lib/boxify/dimensionable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#depthObject

Returns the value of attribute depth.



3
4
5
# File 'lib/boxify/dimensionable.rb', line 3

def depth
  @depth
end

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/boxify/dimensionable.rb', line 3

def height
  @height
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/boxify/dimensionable.rb', line 3

def width
  @width
end

Instance Method Details

#areaObject



5
6
7
# File 'lib/boxify/dimensionable.rb', line 5

def area
  width * depth
end

#surface_areaObject



13
14
15
# File 'lib/boxify/dimensionable.rb', line 13

def surface_area
  (2 * height * width) + (2 * height * depth) + (2 * width * depth)
end

#volumeObject



9
10
11
# File 'lib/boxify/dimensionable.rb', line 9

def volume
  width * height * depth
end