Class: Boxify::EligibleBox
- Inherits:
-
Object
- Object
- Boxify::EligibleBox
- Defined in:
- lib/boxify/eligible_box.rb
Instance Attribute Summary collapse
-
#boxes ⇒ Object
readonly
Returns the value of attribute boxes.
-
#space ⇒ Object
readonly
Returns the value of attribute space.
Class Method Summary collapse
Instance Method Summary collapse
- #eligible_box_with_largest_volume ⇒ Object
- #eligible_boxes ⇒ Object
-
#initialize(boxes:, space:) ⇒ EligibleBox
constructor
A new instance of EligibleBox.
Constructor Details
#initialize(boxes:, space:) ⇒ EligibleBox
Returns a new instance of EligibleBox.
6 7 8 9 |
# File 'lib/boxify/eligible_box.rb', line 6 def initialize(boxes:, space:) @boxes = boxes @space = space end |
Instance Attribute Details
#boxes ⇒ Object (readonly)
Returns the value of attribute boxes.
4 5 6 |
# File 'lib/boxify/eligible_box.rb', line 4 def boxes @boxes end |
#space ⇒ Object (readonly)
Returns the value of attribute space.
4 5 6 |
# File 'lib/boxify/eligible_box.rb', line 4 def space @space end |
Class Method Details
.find_all(boxes:, space:) ⇒ Object
11 12 13 |
# File 'lib/boxify/eligible_box.rb', line 11 def self.find_all(boxes:, space:) new(boxes: boxes, space: space).eligible_boxes end |
.find_best_fit(boxes:, space:) ⇒ Object
15 16 17 |
# File 'lib/boxify/eligible_box.rb', line 15 def self.find_best_fit(boxes:, space:) new(boxes: boxes, space: space).eligible_box_with_largest_volume end |
Instance Method Details
#eligible_box_with_largest_volume ⇒ Object
23 24 25 |
# File 'lib/boxify/eligible_box.rb', line 23 def eligible_box_with_largest_volume @eligible_box_with_largest_volume ||= find_box_with_largest_volume(eligible_boxes) end |
#eligible_boxes ⇒ Object
19 20 21 |
# File 'lib/boxify/eligible_box.rb', line 19 def eligible_boxes @eligible_boxes ||= find_eligible_boxes end |