Class: Boxify::Container
- Inherits:
-
Object
- Object
- Boxify::Container
- Includes:
- Dimensionable
- Defined in:
- lib/boxify/container.rb
Instance Attribute Summary collapse
-
#placed_boxes ⇒ Object
Returns the value of attribute placed_boxes.
Attributes included from Dimensionable
Instance Method Summary collapse
-
#initialize(width:, depth:, height:) ⇒ Container
constructor
A new instance of Container.
- #volume_of_placed_boxes ⇒ Object
- #wasted_space_percentage ⇒ Object
Methods included from Dimensionable
Constructor Details
#initialize(width:, depth:, height:) ⇒ Container
Returns a new instance of Container.
7 8 9 10 11 |
# File 'lib/boxify/container.rb', line 7 def initialize(width:, depth:, height:) @width = width @depth = depth @height = height end |
Instance Attribute Details
#placed_boxes ⇒ Object
Returns the value of attribute placed_boxes.
5 6 7 |
# File 'lib/boxify/container.rb', line 5 def placed_boxes @placed_boxes end |
Instance Method Details
#volume_of_placed_boxes ⇒ Object
13 14 15 |
# File 'lib/boxify/container.rb', line 13 def volume_of_placed_boxes placed_boxes.volume end |
#wasted_space_percentage ⇒ Object
17 18 19 |
# File 'lib/boxify/container.rb', line 17 def wasted_space_percentage (volume - volume_of_placed_boxes).to_f / volume * 100 end |